Find Rows In Data : DataSet : ADO.Net C# Examples


C# Examples » ADO.Net » DataSet »

 

Find Rows In Data









    
using  System;
using  System.Data;
using  System.Data.SqlClient;

class  MainClass  
{
    public  static  void  Main()
    {
        SqlConnection  MyConnection  =  new  SqlConnection("server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated  Security=SSPI;");
        SqlDataAdapter  MyDataAdapter  =  new  SqlDataAdapter("SELECT  *  FROM  Employee",  MyConnection);
        SqlCommandBuilder  MyCmd  =  new  SqlCommandBuilder(MyDataAdapter);
        DataSet  MyDataSet  =  new  DataSet();

        MyDataAdapter.Fill(MyDataSet);

        DataColumn[]  MyKey  =  new  DataColumn[1];

        MyKey[0]  =  MyDataSet.Tables[0].Columns[0];
        MyDataSet.Tables[0].PrimaryKey  =  MyKey;

        DataRow  FindMyRow  =  MyDataSet.Tables[0].Rows.Find(1);
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo ADO.Net
» DataSet