string connectionstring = "server=MUKESH-PC\\SQLEXPRESS;database=Chat;trusted_connection=yes";
SqlConnection con
= new SqlConnection(connectionstring);
SqlDataAdapter adp
= new SqlDataAdapter("select * from users", con);
DataSet ds
= new DataSet();
adp.Fill(ds, "student");
int s=ds.Tables[0].Rows.Count;
Get Values in the Dataset
First Row
String
field1=ds.Tables[0].Rows[0].ItemArray[0].ToString();
String field2=ds.Tables[0].Rows[0].ItemArray[1].ToString();
Second Row
String
field1=ds.Tables[0].Rows[1].ItemArray[0].ToString();
String
field2=ds.Tables[0].Rows[1].ItemArray[1].ToString();
No comments:
Post a Comment