Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm loading information from DB into DataTable with the following code:
data = new DataTable();
if (connection.State != ConnectionState.Open) connection.Open();
da = new MySqlDataAdapter(query, connection);
cb = new MySqlCommandBuilder(da);
try
{
    da.Fill(data);
}
catch(Exception)
{
    return;
}


After doing an update
C#
da.Update(data);


adapter read only columns. This went fine until a Windows update (don't know wich). Do you know why?
Posted

1 solution

I think you are missing the assigning the update command from the commandbuilder to the dataadapter.

C#
da.UpdateCommand = cb.GetUpdateCommand();


at least that is how I recall it needing to be done, you would think it would assign it automatically since your passing the dataadapter as a parameter, but if my memory serves me correctly you have to apply any of the commands you want from the commandbuilder.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900