Below is the sample example for binding the Dataset with the DataGridView.
string connectStr = "Server=Systemname\\SQLR2;Database=Practice_Temp;Trusted_Connection=Yes;";
SqlConnection conn = new SqlConnection(connectStr);
conn.Open();
SqlDataAdapter adap = new SqlDataAdapter("select * from Temp_Dataset", conn);
DataSet ds = new DataSet("dset");
adap.Fill(ds);//,"Tempee_Datset");
dataGridView1.DataSource = ds.Tables[0];
No comments:
Post a Comment