mysqlcommandbuilder and generated commands for update
Posted by: Catalin Neagu
Date: September 13, 2006 01:16PM

i want to fill one dataset with 2 datatables inside using different dataadapters and commandbuilders for each table...(connector .net 1.0.7)

.....

'1
cmd.Connection = conn
cmd.CommandText = "SELECT * FROM driver"
daDriver.SelectCommand = cmd
cbDriver.DataAdapter = daDriver
daDriver.Fill(dsDriver, "driver")
'2
cmd.CommandText = "SELECT * FROM paper"
daPaper.SelectCommand = cmd
daPaper.MissingSchemaAction = MissingSchemaAction.AddWithKey
cbPaper.DataAdapter = daPaper
daPaper.Fill(dsDriver, "paper")
....
Dim mc1, mc2 As New MySqlCommand
mc1 = cbDriver.GetInsertCommand()
MessageBox.Show(mc1.CommandText.ToString)
mc2 = cbPaper.GetInsertCommand()
MessageBox.Show(mc2.CommandText.ToString)

In this case mc1 and mc2 contains the same insertcommand (the one for second table) not two different for each table and when i want to update(insert) in first table in database with

Me.BindingContext(dsDriver, "driver").EndCurrentEdit()
daDriver.Update(dsDriver, "driver")

the result is the following error message
Column 'ID' does not belong to table driver

(because ID belong to second table and the first insertcommand for table driver do not exist)

Is necessary 2 datasets (one for each table ) to make possible the update in each one?



Edited 1 time(s). Last edit at 09/13/2006 01:18PM by Catalin Neagu.

Options: ReplyQuote


Subject
Written By
Posted
mysqlcommandbuilder and generated commands for update
September 13, 2006 01:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.