J
João Santa Bárbara
Hi all,
i have a problem with a transaction.i will tray to explain my problem.
i have a Dataset that i have fill using 2 DataAdapter with a simple query
( all tables with an autonumber).
i have made code for the dataadapter rowupdate to get the @@identity of my
table.
everything works fine.
now is the problem,
i have made a transaction to made this works,
when i do the endcurrent edit of my CurrencyManager, i want to submit the
row to the DataBase.
i have submited the first table and works fine
when i try to submit the second table it throws an exception.
after that every thing is ok
but when i press again the save button
when i´m going to submit the first table again it throws an cocurrency
violation, and the row state
of the row that i´m try to submit have changed the rowstate from Added to
Modified. anyone knows why ??
thsk
JSB
plsea see the code below
so i have made some thing like this
'update Function
dim cmd as SQlClient.CommandBulider ( DataAdapter)
dim cmd1 as SQlClient.CommandBulider ( DataAdapter2)
try
BD.Open
trans = bd.BeginTransaction
DataAdapter.update ( Ds,Table)
' some code that mades a error
' bla bla bla
' in this peace of code ocurs an Error that throws an Exception
DataAdapter2.update ( Ds,Table2)
trans.comit
catch
trans.rollback
finally
bd.close
end try
i have a problem with a transaction.i will tray to explain my problem.
i have a Dataset that i have fill using 2 DataAdapter with a simple query
( all tables with an autonumber).
i have made code for the dataadapter rowupdate to get the @@identity of my
table.
everything works fine.
now is the problem,
i have made a transaction to made this works,
when i do the endcurrent edit of my CurrencyManager, i want to submit the
row to the DataBase.
i have submited the first table and works fine
when i try to submit the second table it throws an exception.
after that every thing is ok
but when i press again the save button
when i´m going to submit the first table again it throws an cocurrency
violation, and the row state
of the row that i´m try to submit have changed the rowstate from Added to
Modified. anyone knows why ??
thsk
JSB
plsea see the code below
so i have made some thing like this
'update Function
dim cmd as SQlClient.CommandBulider ( DataAdapter)
dim cmd1 as SQlClient.CommandBulider ( DataAdapter2)
try
BD.Open
trans = bd.BeginTransaction
DataAdapter.update ( Ds,Table)
' some code that mades a error
' bla bla bla
' in this peace of code ocurs an Error that throws an Exception
DataAdapter2.update ( Ds,Table2)
trans.comit
catch
trans.rollback
finally
bd.close
end try