G
george baburanos
The problem is that when I edit an insert
command generated by the cb resets the commandtext
whenever I do an update with the related DataAdapter.
<VB CODE>
sqlc = New SqlClient.SqlConnection(sConnection)
da = New SqlClient.SqlDataAdapter(sSelect, sqlc)
ds = New DataSet
cb = New SqlClient.SqlCommandBuilder(da)
cb.QuotePrefix = "["
cb.QuoteSuffix = "]"
'THIS LINE NOT WORKS ON UPDATE !!!!
da.InsertCommand.CommandText&=" ; SELECT * FROM General WHERE
GeneralID=SCOPE_IDENTITY()"
da.Fill(ds)
'new rows are added here
da.Update(ds)
da.Fill(ds)
</VB CODE>
If I request the da.InsertCommand.CommandText after the update,
the part I added (with scope_identity) is nowhere to be found. In
fact, if I change the InsertCommand's command text to something
invalid before the update, then the Update just ignores it (most
likely because the CommandBuilder resets the commandtext to its
original value in the process).
Any ideas to make this work?
Thank you
George
command generated by the cb resets the commandtext
whenever I do an update with the related DataAdapter.
<VB CODE>
sqlc = New SqlClient.SqlConnection(sConnection)
da = New SqlClient.SqlDataAdapter(sSelect, sqlc)
ds = New DataSet
cb = New SqlClient.SqlCommandBuilder(da)
cb.QuotePrefix = "["
cb.QuoteSuffix = "]"
'THIS LINE NOT WORKS ON UPDATE !!!!
da.InsertCommand.CommandText&=" ; SELECT * FROM General WHERE
GeneralID=SCOPE_IDENTITY()"
da.Fill(ds)
'new rows are added here
da.Update(ds)
da.Fill(ds)
</VB CODE>
If I request the da.InsertCommand.CommandText after the update,
the part I added (with scope_identity) is nowhere to be found. In
fact, if I change the InsertCommand's command text to something
invalid before the update, then the Update just ignores it (most
likely because the CommandBuilder resets the commandtext to its
original value in the process).
Any ideas to make this work?
Thank you
George