StatCounter

View My Stats

Tuesday, February 5, 2008

Set Primary key to the DataTable-in .NET

Set Primary key to the DataTable-in .NET


Create primary key to the Table that present inside the DataSet:

Ds.Tables[0].PrimaryKey = new DataColumn[] { Ds.Tables[0].Columns["id1"]};

For above: id1 is DataColumn


Set Primary key to the Single Table:

Dt.PrimaryKey=new DataColumn[]{Dt.Columns["id1"]};


For above:

Dt-DataTable Name.
id1-DataColumn

No comments: