Monday, 24 November 2014

select Nth salary from employee table using sql query with top query

SELECT MAX(EmpSalary) as 'EmpSalary' from tblEmployeeDetails
where Salary NOT IN
(
SELECT TOP n-1 (EmpSalaryfrom tblEmployeeDetails ORDER BY EmpSalary Desc
) 

// 2nd
SELECT MAX(EmpSalary) as 'EmpSalary' from tblEmployeeDetails
where Salary NOT IN
(
SELECT TOP 1 (EmpSalary) from tblEmployeeDetails ORDER BY EmpSalary Desc
) 
Result-14000

// 3nd
SELECT MAX(EmpSalary) as 'EmpSalary' from tblEmployeeDetails
where Salary NOT IN
(
SELECT TOP 2 (EmpSalary) from tblEmployeeDetails ORDER BY EmpSalary Desc
)
 Result-13000

Saturday, 15 November 2014

Get Controls type inside Gridview in asp.net code behind

//HTML
<asp:GridView ID="GridView1" runat="server" ></asp:GridView>

//C#
foreach (Control clt in GridView1.Rows[0].Controls)
                {
                    foreach (Control clt1 in clt.Controls)
                    {
                        if (clt1 is TextBox)
                        {
                            ((TextBox)clt1).BackColor = validateColor;
                        }
                        else if (clt1 is DropDownList)
                        {
                            ((DropDownList)clt1).BackColor = validateColor;
                        }
                    }
                }

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...