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 GujrathiRank #666 · 3.6K reputationPosted Apr 19, 2011, 12:43 AM EDT
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
VulpesRank #55 · 29.2K reputationPosted Apr 19, 2011, 12:44 AM EDT
ds.Tables[0].PrimaryKey.Length;
If it's zero, then no primary key has been set.
Rahul Patil16 reputationPosted Apr 19, 2011, 1:14 AM EDT
Mayur GujrathiRank #666 · 3.6K reputationPosted Apr 19, 2011, 1:44 AM EDT