Bonjour, je suis débutant en C# et j'ai un problème avec l'update d'un dataset avec System.Data.SqlClient.
Je suis capable de remplir mon dataset avec le fill. Mais si je modifie mon dataset, je ne suis pas capable de mettre a jour la bd avec le update.
SqlConnection cn = new SqlConnection();
DataSet CustomersDataSet = new DataSet();
SqlDataAdapter da;
SqlCommandBuilder cmdBuilder;
//Set the connection string of the SqlConnection object to connect
//to the SQL Server database in which you created the sample
//table.
cn.ConnectionString = "Data Source=localhost;integrated security=SSPI;Initial Catalog=CLASSEURDB";
cn.Open();
//Initialize the SqlDataAdapter object by specifying a Select command
//that retrieves data from the sample table.
da = new SqlDataAdapter("select Name, NomThick, MinThick, MaxThick from list_Thickness order by ID", cn);
//Initialize the SqlCommandBuilder object to automatically generate and initialize
//the UpdateCommand, InsertCommand, and DeleteCommand properties of the SqlDataAdapter.
cmdBuilder = new SqlCommandBuilder(da);
//Populate the DataSet by running the Fill method of the SqlDataAdapter.
da.Fill(CustomersDataSet);
CustomersDataSet.Tables[0].Rows[0]["MaxThick"] = 1.234;
//Modify the value of the CustName field.
//CustomersDataSet.Tables["Customers"].Rows[0]["CustName"] = "Jack";
//Post the data modification to the database.
da.Update(CustomersDataSet);
//Close the database connection.
cn.Close();
Merci de votre aide!!