Ok, now i have tried it and it worked, thanks.
But i have one big question now...
I have now removed from the database the Autoincrement feature for the ID
column, I moved it to the Dataset containing the same scheme of that table
(so, the SQLDataAdapter will receive the ID as a parameter to include it in
the database).
If i ever use this from more than one PC (supose i set up a SQL Server and
two PC connected over a LAN to get the data) I will have a LOT of concurrency
problems with this setup...
If i always wait until the form is closed to make all the updates i could
create HUGE disasters if both users access at the same time.
To put an example, lets supose userA and userB opens the application at the
same time, both go to the Providers Form.... userA starts creating some new
providers... userB starts creating other new providers.
Since both got the same original data, their new providers will start after
the last ID that they have (Autoincrement feature of the Dataset)...
The first one to close the form will be the one to put the changes on the
database, the other will just receive an exception...
How i can avoid that?
Any help will be great.... right now i will not have problems, but if in the
future i expand the application... everything will have to be changed...
"Fernando" wrote:
ok, gonna try it, thanks!
"Ansil MCAD" wrote:
hi
in the closing event of the form
check this
if(myDataSet.Ha sChanges(DataRo wState.Modified ))
update the dataset to db
only one thing you should take care is that you call it before you accept
the changes DataSet.AcceptC hanges
regards
ansil
"Fernando" wrote:
I am having problems with updating the changes done over a DataSet to a
Database.
All the changes being done using the Form are stored in the Dataset, but
when i decide to close the Form and open the form again, the changes are lost.
Also, the modification process works great, but adding or deleting a row
doesn't work.
I am using a SQLDataAdapter to manage all the
insert/delete/modification/select over the table.
I supose the problem is caused because i am calling:
this.sql_DA_Tab le.Update(this. Dataset)
in the wrong place.
Where i should use it?
in the Dataset.ChangeR ow event?
in the Dataset.Changin gRow event?
in the Dispose event?
in another place?
Thanks for your time.