Hi,

I'm using C#, Access 2007 and VS2008 to write a windows app.

I have populated a datagridview from a query (taking data from 2 tables). When the user clicks "Save", I want to be able to save any changes made in the datagridview to the database. Only one column in the datagridview is editable, so any changes will be made to just the one table in the database.

I could possibly do something using the CellEndEdit event, but that would fire for each cell that is updated, which is a bit clunky.

So, can anyone please tell me how I can write data back to the database, when the original datagridview is populated from a query?

Thanks in advance,
Jon

Hi,

I'm using C#, Access 2007 and VS2008 to write a windows app.

I have populated a datagridview from a query (taking data from 2 tables). When the user clicks "Save", I want to be able to save any changes made in the datagridview to the database. Only one column in the datagridview is editable, so any changes will be made to just the one table in the database.

I could possibly do something using the CellEndEdit event, but that would fire for each cell that is updated, which is a bit clunky.

So, can anyone please tell me how I can write data back to the database, when the original datagridview is populated from a query?

Thanks in advance,
Jon

Hello Jon,

For datagridview, you MUST have one Primary key in your database.

Try it out and let me know if you have any problem.

Also Please see: http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/666835a2-50ec-415f-ba30-bb80ca51c91b

Welcome @i_microsoft.

We appreciate your knowledge. Please do not resurrect old/solved thread.

Thread Closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.