Hi,
I'm writing a MySQL database manager in C# - Visual Studio 2008. Consider this scenario: have a DataGridView object showing the data in a table from a certain database the user connected to.
The user changes the value in a field. This table may or may not contain a primary key. This change is expected to be saved into the database table.
I obviously need to run an UPDATE query (which I know how to do), but what I don't know how to do is figure out what the selectors for that query should be. I.e: what data do I need to gather to make sure that the specific field the user changes is the one that is updated, and nothing else?
Keep in mind that the rows could be out of order in the DataGridView because the user can sort them any way they want.
Thanks for any aid.
DataGridView objects and MySQL databases
Started by mholt, Mar 19 2008 06:01 PM
1 reply to this topic
#1
Posted 19 March 2008 - 06:01 PM
|
|
|
#2
Posted 01 April 2008 - 06:46 AM
You could try binding the datagridview to the database. This will automatically update them, with a lot less work.
How about loading the data into a DataSet, then making the change to one of its properties, before updating the data back again? That way, only the specified change is updated. There's no harm in reupdating the same value in the field, eh?
I tend to steer clear from databases and store everthing in XML Files, as they're so much easier to use. Just use some objects from the System.Xml namespace, and voila!
But that's just me being lazy. Xav
How about loading the data into a DataSet, then making the change to one of its properties, before updating the data back again? That way, only the specified change is updated. There's no harm in reupdating the same value in the field, eh?
I tend to steer clear from databases and store everthing in XML Files, as they're so much easier to use. Just use some objects from the System.Xml namespace, and voila!
But that's just me being lazy. Xav


Sign In
Create Account


Back to top









