How would you guys approach this. Im manually populating a MSFLEXGRID
with records from an access database, and displaying it to the user. I
want to give the user an edit button, putting them in an edit mode
that allows them to change any of the data in the cells using floating
textboxes. Once they were done editing they would click a save button
to commit the changes to the database.
I was going to track the changes using a multidimensional array to
store what row/column changed and what the new value was. Then use an
update statement to update the record in the database. However I see
several problems with that.
The first being that the update statement only allows you to update
one field at a time. If say the record contained 20 fields, and the
user changed all the fields in a record, it would require 20 different
updates statements. Which would bring me to my second problem.
If I was populating the changes as they happened in an array, and then
tried to update based on the information in the array, after I did the
first update statement, the data I was trying to compare to using the
where statement will have changed in the database - but not in the
array. Therefore the update statement would be erroneous and not
update any records.
I could store all the changes and all the data that didnt change in an
array for a particular row, and then delete the original record. Then
use data stored in the array to create a new record using the insert
statement. However, I believe there are limitations to how large an
insert statement can be. Like the number of fields it can contain, or
the actual length of the statement itself. I believe I have ran into
that error before.
So if you wanted to do something like this. How would you store the
changes, and how would you commit all the changes at once when the
user wanted to exit the edit mode and save the changes.
Thanks in advance.