OleDB - DataRow update and Transaction 
Author Message
 OleDB - DataRow update and Transaction

Hope you're all ready to help a stupid collegue :D

I simply want to update some data in a DataSet in a Transaction - works fine
for the first time I run this update function, but the second time I get the
error that the command doesn't have transaction properties set...

Think the problem might be, that after the Update the DataSet object doesn't
get properly "refreshed"...
All works fine if the Transaction code is removed..

Here's the code fragement:

conn - OleDBConnection
m_da - OleDBDataAdapter
m_cb - OleDBCommandBuilder
m_ds - OleDBDataSet

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSave.Click

Dim dr As DataRow
Dim db_trans As System.Data.OleDb.OleDbTransaction

db_trans = conn.BeginTransaction

m_cb.DataAdapter.SelectCommand.Transaction = db_trans

dr = m_ds.Tables(0).NewRow()
u_TransferValues(True, dr)    'transfers some values to the DataRow
m_ds.Tables(0).Rows.Add(dr)

m_da.Update(m_ds)

db_trans.Commit()

m_ds.AcceptChanges()

End Sub

As stated before... works for the first time ... but run function the second
time (without and action in between) fails... ??

I'll buy the ones who can help me a beer - if I'll meet them....
Thanx,
Thomas



Wed, 19 Oct 2005 18:33:13 GMT  
 OleDB - DataRow update and Transaction
Hello,


Quote:
> I simply want to update some data in a DataSet in a Transaction
> - works fine for the first time I run this update function, but the
> second time I get the error that the command doesn't have
> transaction properties set...

Maybe people in the ng mentioned below can help you:


Regards,
Herfried K. Wagner



Sat, 22 Oct 2005 03:53:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem updating a datarow

2. oledb: foxpro index file not updating after inserts and updates

3. Microsoft.Jet.OLEDB.4.0 - transaction

4. Microsoft.Jet.OLEDB.4.0 - transaction

5. oledb update command not inserting recently added row...

6. All messed up with OLEDB, Access2000 & Update

7. Problem updating a database from a dataset using OLEDB command builder

8. Updating child recordsets using the Microsoft.Jet.OLEDB.3.51 provider

9. ADO Recordset Status Property and True Grid Pro 5.0 with OLEDB Update

10. Update queries in transactions

11. Update Indexed Field In Transaction

12. DAO Bug? Updates in transactions

 

 
Powered by phpBB® Forum Software