filling of datagrid
i m trying to fill datadrid (dg1) from the data set (ds) of the table (emp) ,my code is like that
private void bt1_Click(object sender, System.EventArgs e)
{
string select = "SELECT * FROM emp";
SqlConnection cnn=new SqlConnection("Data source=localhost;Integrated Security=SSPI;" + "Initial Catalog=Rahul");
SqlCommand cmd = new SqlCommand(select , cnn);
SqlDataAdapter da = new SqlDataAdapter ( select ,cnn);
DataSet ds = new DataSet();
da.Fill(ds , "emp");
MessageBox.Show("rahul");
dg1.SetDataBinding(ds,"emp");
}
BUT COMPILER GIVES "SYSTEM ERROR"
please solve my problem.
|