How to use a c# datagridview to update a database file just like Access does?
Posted
by
mackeyka
on Stack Overflow
See other posts from Stack Overflow
or by mackeyka
Published on 2012-04-13T17:23:28Z
Indexed on
2012/04/13
17:30 UTC
Read the original article
Hit count: 299
I have googled everywhere and I am finally giving up and asking here.
I am working in Visual Studio 2010 with C#. I have set up a form with a datagridview connected to a MSSQL database and I need to save changes made in the datagridview back to the physical database. I am having some success but I think that I am going about some of it completely wrong because I can not get it to save consistently.
What I really want is for the updates to work just like they do when working with Access. When I edit a row in the datagridview and then leave that row, either by selecting another row or by selecting some other control on the form or even by changing to another form or quitting the application the row should be automatically pdated to the physical database.
The first part of this question I think is, what is the proper event to use to trigger the save and then second what methods should be used to actually write the data to the database?
© Stack Overflow or respective owner