RowUdating Event

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
 
K

Kevin Yu [MSFT]

Hi Michael,

It seems that I could not reproduce the problem. I've checked the way you
update the database, are you setting the Status to SkipCurrentRow? If not,
the performance might not be increased. Could you paste your RowUpdating
event handler code here?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top