A day with .Net

My day to day experince in .net

How to use the find method associated with the datatable

Posted by vivekcek on July 21, 2009

Find method in datatable is used to find a particaular row in datatable.For that we have to

set one coulmn of the datatable as promary key.The below code do this things

DataColumn[] dlc = new DataColumn[1];
dlc[0] = dt_Supplier.Columns[0];
dt_Supplier.PrimaryKey = dlc;

In the above datatable if we supply the 0th coulmns value in find() method we can identyfy a

unique row

For deleting a particular row we can use the following method in the case of above table

 public void DeleteItem(string Sup_Code)

            DataRow DelRow = dt_Supplier.Rows.Find(Sup_Code);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s