Adapter with dynamic update statement

  • Thread starter Thread starter lc
  • Start date Start date
L

lc

The update that gets generated with adapters always include all the
columns. That means that with each record update, all the columns get
updated as well. This presents a bit of a problem as I have some
triggers going on changes on specific fields. Is there way to instruct
adapter to regenerate the update statement based on changed columns
only?

TIA

lc
 
I am not sure on this - I can see reasons why it won't work.
Try and see what happens.
 
Well, just a shot in the dark, but how about if you
declare your sql DataAdapter like this:
....
Dim sqlDA As SqlDataAdapter = new SqlDataAdapter
sqlDA.SelectCommand = New SqlCommand("Select fld1, fld2,
fld3 From tbl1", conn)
Dim cmdBd As CommandBuilder = new CommandBuilder(sqlDA)

Say tbl1 contains 10 fields, your dataAdapter is only
connecting to 3 fields. I don't know if selecting fields
that are not triggered and then running an insert command
won't set off the triggers. But you could try this.

Rich
 
Good shot. Thanks.

In the meantime, it "occurred" to me that the command has to change
with each record to be updated. Adapter.RowUpdating and RowUpdated
come to mind.

lc
 
Back
Top