Becks25Not
Programmer
Hello All,
I get an error in the follwing code. I have several tables in the dataset. I am trying to update them to the database using the data adapter's update method. I am using command's I created because there are protected columns and I read the command builder is not good for when there auto-increment columns. Table 1 and Table 2's update and inserts work great. I get the error on updating table 3. It has to do with the update method ... it is trying to use the update method from table 2. If I set the text of the UpdateCommand to "", I get a not initialized error. Is there a way around this (or a better way to do this?)
Thanks!!
~Becca
Code:
I get an error in the follwing code. I have several tables in the dataset. I am trying to update them to the database using the data adapter's update method. I am using command's I created because there are protected columns and I read the command builder is not good for when there auto-increment columns. Table 1 and Table 2's update and inserts work great. I get the error on updating table 3. It has to do with the update method ... it is trying to use the update method from table 2. If I set the text of the UpdateCommand to "", I get a not initialized error. Is there a way around this (or a better way to do this?)
Thanks!!
~Becca
Code:
Code:
'** Tbl1
Me.daDb.UpdateCommand = Me._TableStructures.Tbl1UpdateCommand
Me.daDb.UpdateCommand.Connection = Me.conDb
Me.daDb.InsertCommand = Me._TableStructures.Tbl1InsertCommand
Me.daDb.InsertCommand.Connection = Me.conDb
Me.daDb.Update(Me.dt1)
'** Tbl2
Me.daDb.UpdateCommand = Me._TableStructures.Tbl2UpdateCommand
Me.daDb.UpdateCommand.Connection = Me.conDb
Me.daDb.InsertCommand = Me._TableStructures.Tbl2InsertCommand
Me.daDb.InsertCommand.Connection = Me.conDb
Me.daDb.Update(Me.dt2)
'** Tbl3
Me.daDb.InsertCommand = Me._TableStructures.Tbl3InsertCommand
Me.daDb.InsertCommand.Connection = Me.conDb
[COLOR=red] Me.daDb.Update(Me.dt3) 'FAILS HERE W/ aforementioned exceptions [/color]
Me.dsDb.AcceptChanges()