Translate

Wednesday 26 January 2022

Jquery modal popup on page load

 

<html lang="en">
<head>
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>Document</title>
 </head>
 <body>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="container">
    <!-- Modal -->
    <div class="modal fade" id="myModal" role="dialog">
        <div class="modal-dialog">

            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Modal Header</h4>
                </div>
                <div class="modal-body">
                    <p>Some text in the modal.</p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>

        </div>
    </div>

</div>
<script>
$( document ).ready(function() {
    let todaysDate = new Date();
    // let dateOfClosing = new Date('02 03 2022'); // 03 Feb 2022  
    let dateOfClosing = new Date('01 25 2022'); // new Date('mm dd yyyy')
   
     alert('Date Of Closing:'+dateOfClosing);
     alert('Todays Date:'+todaysDate);

        if(todaysDate<=dateOfClosing)
        {
        $('#myModal').modal('show');
        }
});
</script>
</body>
</html>

Friday 21 January 2022

sql query for count number of parameters in user stored procedures

 SELECT 

    p.name AS Parameter,        

    t.name AS [Type]

FROM sys.procedures sp

JOIN sys.parameters p 

    ON sp.object_id = p.object_id

JOIN sys.types t

    ON p.system_type_id = t.system_type_id

WHERE sp.name = 'usp_get_customer' order by p.name

Monday 17 January 2022

table format - candidate registration form

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Candidate Registration Form</title>

</head>

<body>

<h2>Candidate Registration Form</h2>

<form id="register" method="post">

<table>

                        <tr> 

                            <td colspan="6" style="text-align: right;margin-right:5px;color:red;font-size: 15pt;"><b>* fields are mandatory </b></td>                            

                        </tr>  

                        <tr> 

                            <td colspan="6"></td>                            

                        </tr>  

                        <tr> 

                            <td colspan="6"></td>                            

                        </tr>  

                        <tr>                            

                            <td>

                                <b>1. <span style="color:red;">*</span>First Name</b>

                            </td>

                            <td>

                                <input type="text" name="firstName" tabindex="1" max="30" title="Enter candidate first name" id="txtFirstName" placeholder="First Name" required> 

                            </td>                      

                        <td>

                            <b>2. Middle Name</b>

                        </td>

                        <td>

                            <input type="text" name="middleName" tabindex="2" max="30" title="Enter candidate middle name" id="txtMiddleName" placeholder="Middle Name"> 

                        </td>

                        <td>

                            <b>3. <span style="color:red;">*</span>Last Name</b>

                        </td>

                        <td>

                            <input type="text" name="lastName" tabindex="2" max="30" title="Enter candidate Last Name" id="txtLastName" placeholder="Last Name" required>  

                        </td>                             

                    </tr> 

                    <tr>                            

                        <td>

                            <b>4. <span style="color:red;">*</span>Father Name</b>

                        </td>

                        <td>

                            <input type="text" name="fatherName" tabindex="4" max="100" title="Enter candidate father name" id="txtFatherName" placeholder="Father Name" required> 

                        </td>                      

                    <td>

                        <b>5. <span style="color:red;">*</span>Mother Name</b>

                    </td>

                    <td>

                        <input type="text" name="motherName" tabindex="5" max="100" title="Enter candidate Mother Name" id="txtMotherName" placeholder="Mother Name"> 

                    </td>

                    <td>

                        <b>6. Gurdian Name</b>

                    </td>

                    <td>

                        <input type="text" name="gurdianName" tabindex="6" max="100" title="Enter candidate gurdian name" id="txtGurdianName" placeholder="Gurdian Name">  

                    </td>                         

                </tr> 

                <tr>                            

                    <td>

                        <b>7. <span style="color:red;">*</span>Date of birth</b>

                    </td>

                    <td>

                        <input type="date" name="dateOfBirth" tabindex="7" max="10" title="Enter candidate date of birth" id="txtDateOfBirth" placeholder="Date of birth" required> 

                    </td>                      

                <td>

                    <b>8. <span style="color:red;">*</span>Gender</b>

                </td>

                <td>

                    <input type="radio" name="male" tabindex="8"  title="Male">Male

                    &nbsp;

                    <input type="radio" name="female" tabindex="9"  title="Female">Female 

                    &nbsp;

                    <input type="radio" name="others" tabindex="10"  title="Others">Others

                    &nbsp;

                </td>

                <td>

                    <b>9. <span style="color:red;">*</span>Mobile Number</b>

                </td>

                <td>

                    <input type="number" name="gurdianName" tabindex="11" max="10" title="Enter candidate mobile number" id="txtMobileNumber" placeholder="Mobile Number">  

                </td>                     

            </tr>

            <tr>                            

                <td>

                    <b>10. Whatsapp Number</b>

                </td>

                <td>

                    <input type="number" name="gurdianName" tabindex="12" max="10" title="Enter candidate whatsapp number" id="txtWhatsappNumber" placeholder="Mobile Number">  

                </td>                   

                <td>

                    <b>11. Email</b>

                </td>

                <td>

                    <input type="text" name="email" tabindex="13" max="256" title="Enter candidate Email" id="txtEmail" placeholder="Email">  

                </td>

                <td>

                    <b>12. Address</b>

                </td>

                <td>

                    <textarea name="address" tabindex="14" max="256" title="Enter candidate Address" id="txtAddress" placeholder="Address"> </textarea>

                </td>  

            </tr> 

            <tr>                            

                <td>

                    <b>13. <span style="color:red;">*</span>Pincode</b>

                </td>

                <td>

                    <input type="number" name="pincode" tabindex="15" max="6" title="Enter candidate Pincode" id="txtPincode" placeholder="Pincode">  

                </td>                   

                <td>

                    <b>14. <span style="color:red;">*</span>Matriculation mark</b>

                </td>

                <td>

                    <input type="number" name="matriculationMark" tabindex="16" max="5" title="Enter candidate Matriculation mark" id="txtMatriculationMark" placeholder="Matriculation mark">  

                </td>

                <td>

                    <b>15. <span style="color:red;">*</span>Intermediate mark</b>

                </td>

                <td>

                    <input type="number" name="intermediateMark" tabindex="17" max="5" title="Enter candidate Intermediate mark" id="txtIntermediateMark" placeholder="Intermediate mark">  

                </td> 

            </tr> 

            <tr>                            

                <td>

                    <b>16. Graduation mark</b>

                </td>

                <td>

                    <input type="number" name="graduationMark" tabindex="18" max="6" title="Enter candidate Graduation mark" id="txtGraduationMark" placeholder="Graduation mark">  

                </td>                   

                <td>

                    <b>17. Post graduation mark</b>

                </td>

                <td>

                    <input type="number" name="postGraduationMark" tabindex="19" max="5" title="Enter candidate Post graduation mark" id="txtPostGraduationMark" placeholder="Post graduation mark">  

                </td>

                <td>                    

                </td>

                <td>                    

                </td> 

            </tr> 

            <tr> 

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

            </tr>   

            <tr> 

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

            </tr>   

            <tr> 

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

                <td></td>

            </tr>   

            <tr>  

                <td>                    

                </td>      

                <td>                    

                </td>                                

                <td colspan="6">                

                    <input type="submit" id="btnSubmit" value="Submit" tabindex="20" title="Click here for completion of the candidate registration form" >

                    &nbsp;

                    <input type="button"  id="btnCancel"  value="Cancel" tabindex="21" title="Click here for cancel the  candidate registration form" >

                    &nbsp;

                    <input type="button" id="btnReset" value="Reset"  tabindex="22" title="Click here for Reset the  candidate registration form" >

                </td> 

            </tr> 

                    </table>

                </form>            

    </body>

</html>

 

Sunday 16 January 2022

dynamically add column in sql temp table

 CREATE TABLE student 

(

student_id int

,student_name varchar(100)

,class int

)

insert into student(student_id,student_name,class) values(10001,'Pabitra Behera',10);

insert into student(student_id,student_name,class) values(10002,'Swasti Prakash Brahma',10);

insert into student(student_id,student_name,class) values(10003,'Ankit Kalia',10);

CREATE TABLE tsubject 

(

subject_id int

,subjects varchar(100)

 

)

insert into tsubject values(1, 'Odia');

insert into tsubject values(2, 'English');

insert into tsubject values(3, 'Hindi');

create proc USP_GET_DATA

(

@action varchar(10)=null

)

AS BEGIN

SELECT * INTO #tstudent FROM student with(nolock)

 

 declare @COLUMN_NAME varchar(256)

declare _cursor cursor read_only for

select subjects from tsubject

open _cursor

fetch next from _cursor into @COLUMN_NAME

while @@FETCH_STATUS=0

begin

declare @DynamicSQL nvarchar(max);

SET @DynamicSQL = 'ALTER TABLE #tstudent ADD ['+ CAST(@COLUMN_NAME AS NVARCHAR(100)) +'] NVARCHAR(100) NULL'

EXEC(@DynamicSQL) 

 

fetch next from _cursor into  @COLUMN_NAME

end

close _cursor

deallocate _cursor

select * from #tstudent

 

END