I am searching student id from table sid as primary key still i have error no primary key in your table
Int sid=int.parse(interaction.inputBox("Enter id );
Datarow dr=ds.tables[0].Rows.Find(sid);
If(dr!=null)
{
Textbox1.text=dr[0].ToString();//taking student name here
}
else
MessageBox.Show(" id not found");}
Mayur GujrathiPosted Apr 19, 2011, 4:43 AM
generally when you get table in dataset this is not come with keys to do it
try this
sqldataadapter adpt=new sqldataadapter
adpt.missingschemaaction=missingschemaaction.AddWithKey;
this will add table with keys in your dataset
Mayur GujrathiPosted Apr 19, 2011, 5:44 AM
Rahul PatilPosted Apr 19, 2011, 5:14 AM
VulpesPosted Apr 19, 2011, 4:44 AM
ds.Tables[0].PrimaryKey.Length;
If it's zero, then no primary key has been set.