February 16th, 2012, 03:08 AM
Fail update database from DataGridView
I am working at winforms project and i have a datagridview from which i am trying to update a database from it when the user changes something. Here is the code:
DataSet ds = new DataSet();
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["EbosPr.Properties.Settings.Database1ConnectionString1"].ConnectionString);
SqlCommand scmd = new SqlCommand("Select * From CustCalls ", conn);
SqlDataAdapter sda = new SqlDataAdapter(scmd);
DataTable dt = ds.Tables;
SqlCommandBuilder myBuilder = new SqlCommandBuilder(sda);
sda.UpdateCommand = myBuilder.GetUpdateCommand();
The above code doesnt update the database. Any idea?
February 17th, 2012, 12:35 AM
Re: Fail update database from DataGridView
Did you check the below?
Before to your Update command ou have to give
And after to your update command you have to give
Last edited by MAHEY; February 17th, 2012 at 12:39 AM.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!