Monday 28 April 2014

Exporting the gridview data to excel sheet;


Create a grid view and bind the data to grid view now suppose your grid view is looking like below image;



Code for grid view

Sunday 13 April 2014

selected row in datagridview c#

Getting the seltected rwo in the data grid from code behind in C#.

Suppose you give the name of data grid as dg;


Just do compy and paste of the below code you will get the row selected;


   public class EmplyeeBAO
    {
        private ArrayList GetSelectedRows(DataGrid dg)
{
   ArrayList al = new ArrayList();
   CurrencyManager cm = (CurrencyManager)this.
                                    BindingContext[dg.DataSource, dg.DataMember];
   DataView dv = (DataView)cm.List;
   for(int i = 0; i < dv.Count; ++i)
   {
     if(dg.IsSelected(i)) // find out the selected rwo
       al.Add(i);
   }
   return al;
}


Saturday 12 April 2014

SQL Interview Questions and Answer

Clustered and Non-Clustered Index
What is an Index?
Index is a database object, which can be created on one or more columns (16 Max column combination). When creating the index will read the column(s) and forms a relevant data structure to minimize the number of data comparisons. The index will improve the performance of data retrieval.
Primary Key Constraint
A table column with this constraint is called as the key column for the table. This constraint helps the table to make sure that the value is not repeated and also no null entries. A table can have only one Primary key. Multiple columns can participate on the primary key column. Then, the uniqueness is considered among all the participant columns by combining their values.