hello,
I have written this code on button_click event.
but it shows "Object reference not set to an instance of an object" error.
can u help to solve this error.
String conn= "data source= VTECHS; database= bc;uid=greymoun t;password= manish2809";
String str= "select * from details";
SqlDataAdapter da= new SqlDataAdapter( str,conn);
SqlCommandBuild er commb=new SqlCommandBuild er(da);
DataSet ds =new DataSet();
da.Fill(ds);
DataTable dt=new DataTable();
dt=ds.Tables["details"];
dataRow rownew= ds.Tables["details"].NewRow();
rownew["name"]=txtLcode.Text ;
ds.Tables["details"].Rows.Add(rowne w);
da.Update(ds);
I have written this code on button_click event.
but it shows "Object reference not set to an instance of an object" error.
can u help to solve this error.
String conn= "data source= VTECHS; database= bc;uid=greymoun t;password= manish2809";
String str= "select * from details";
SqlDataAdapter da= new SqlDataAdapter( str,conn);
SqlCommandBuild er commb=new SqlCommandBuild er(da);
DataSet ds =new DataSet();
da.Fill(ds);
DataTable dt=new DataTable();
dt=ds.Tables["details"];
dataRow rownew= ds.Tables["details"].NewRow();
rownew["name"]=txtLcode.Text ;
ds.Tables["details"].Rows.Add(rowne w);
da.Update(ds);
Comment