M
Motley Drew
I am having a hell of a time removing a row from my datagrid that was
generated from 2 different tables. I get the following error...
Dynamic SQL generation is not supported against multiple base tables.
...and I can't figure this one out. I have deletes working for all the
other grids on the page, I just can't figure this one out. My code is
posted below (VB).
Thanks in advance.
-Drew
-------------------------------------------
' Create and load a DataSet
Dim adapter As New SqlDataAdapter(strSQLQuery, objConnection)
Dim ds As New DataSet()
adapter.TableMappings.Add("table(0)", "tbl_gen_in_int_conds")
adapter.TableMappings.Add("table(1)", "tbl_gen_in_cond_defns")
adapter.Fill(ds, "tbl_gen_in_int_conds")
' Mark the product as Deleted in the DataSet
Dim tbl As DataTable = ds.Tables("tbl_gen_in_int_conds")
Dim keys(3) As DataColumn
keys(0) = tbl.Columns("INTERFACE_ID")
keys(1) = tbl.Columns("COND_TYPE")
keys(2) = tbl.Columns("CONDITION")
tbl.PrimaryKey = keys
Dim keyVals(2) As String
keyVals(0) = strInterfaceId
keyVals(1) = strType
keyVals(2) = strConId
Dim row As DataRow = tbl.Rows.Find(keyVals)
row.Delete()
' Reconnect the DataSet and delete the row from the database
Dim cb As New SqlCommandBuilder(adapter)
Connect()
adapter.Update(ds, "table(0)")
adapter.Update(ds, "table(1)")
generated from 2 different tables. I get the following error...
Dynamic SQL generation is not supported against multiple base tables.
...and I can't figure this one out. I have deletes working for all the
other grids on the page, I just can't figure this one out. My code is
posted below (VB).
Thanks in advance.
-Drew
-------------------------------------------
' Create and load a DataSet
Dim adapter As New SqlDataAdapter(strSQLQuery, objConnection)
Dim ds As New DataSet()
adapter.TableMappings.Add("table(0)", "tbl_gen_in_int_conds")
adapter.TableMappings.Add("table(1)", "tbl_gen_in_cond_defns")
adapter.Fill(ds, "tbl_gen_in_int_conds")
' Mark the product as Deleted in the DataSet
Dim tbl As DataTable = ds.Tables("tbl_gen_in_int_conds")
Dim keys(3) As DataColumn
keys(0) = tbl.Columns("INTERFACE_ID")
keys(1) = tbl.Columns("COND_TYPE")
keys(2) = tbl.Columns("CONDITION")
tbl.PrimaryKey = keys
Dim keyVals(2) As String
keyVals(0) = strInterfaceId
keyVals(1) = strType
keyVals(2) = strConId
Dim row As DataRow = tbl.Rows.Find(keyVals)
row.Delete()
' Reconnect the DataSet and delete the row from the database
Dim cb As New SqlCommandBuilder(adapter)
Connect()
adapter.Update(ds, "table(0)")
adapter.Update(ds, "table(1)")