M
Michael
Greetings,
I'm working on a process to speed the update of ADO.NET
when doing bulk inserts and updates. Rather than letting
the system use the update command, I'm handling this with
a rowupdating event handler that is to take the command
text, fill in the parameters from the parameter
collection and put this final statement into a
stringbuilder, where I add each row's update/insert into
a batch which is then submitted once, rather than making
thousands of round trips back and forth going row by row.
The problem I'm having is with the rowupdating event
handler. It looks like this.
===========
Public Shared Sub onRowUpdating(ByVal sender As Object,
ByVal e As SqlRowUpdatingEventArgs) Handles da.RowUpdating
============
When you run the following:
da.update(ds) for each row it goes to the above.
for an "updated" existing row:
e.statementtype=update
e.command.commandtext = "UPDATE ...... @p1.....etc...)
for a newly inserted row:
e.statementtype=insert
e.command.commandtext=Nothing
What gives, should it not give the commandtext for the
insert as well? Right before you call the da.update(ds),
if you just do a simply check on
da.insertcommand.commandtext, you get the full insert
command (all 164 parameters in my case).
Is this is bug, or am I just goofy or something. This
all works well with updates to the system (makes ADO.NET
update wicked fast), but no luck with inserts...
Michael
I'm working on a process to speed the update of ADO.NET
when doing bulk inserts and updates. Rather than letting
the system use the update command, I'm handling this with
a rowupdating event handler that is to take the command
text, fill in the parameters from the parameter
collection and put this final statement into a
stringbuilder, where I add each row's update/insert into
a batch which is then submitted once, rather than making
thousands of round trips back and forth going row by row.
The problem I'm having is with the rowupdating event
handler. It looks like this.
===========
Public Shared Sub onRowUpdating(ByVal sender As Object,
ByVal e As SqlRowUpdatingEventArgs) Handles da.RowUpdating
============
When you run the following:
da.update(ds) for each row it goes to the above.
for an "updated" existing row:
e.statementtype=update
e.command.commandtext = "UPDATE ...... @p1.....etc...)
for a newly inserted row:
e.statementtype=insert
e.command.commandtext=Nothing
What gives, should it not give the commandtext for the
insert as well? Right before you call the da.update(ds),
if you just do a simply check on
da.insertcommand.commandtext, you get the full insert
command (all 164 parameters in my case).
Is this is bug, or am I just goofy or something. This
all works well with updates to the system (makes ADO.NET
update wicked fast), but no luck with inserts...
Michael