More than 200 insert queries batch!

  • Thread starter Thread starter asimA
  • Start date Start date
A

asimA

i m using .Net 2003 & SLQ Server, i have more than 200 queries now i m using

For i = 0 to dTable.count -1

query = "sp_City '" dTable.Rows(i).Item("name") & "', '" & dTable.Rows(i).
Item("code") & "'"

Rem calling the ExecuteNonQuery
IF Not execute(query) Then Return False

End For

Return True


here, executing the query one by one, but i want call ExecuteNonQuery just
one time.
how it possible.

Thanks
 
If you are looking to execute as you can build a statment as below

insert into table() values()
go
insert into table() values()
go

Also please StringBuilder class for the above query building.

A thought would be to try Stored Procedure. Looks like you have rows from
DataSet to insert.., not tried how that will work. You could also typed
DataSets.. various options available...

VJ
 
There's no batching on NETCF. Switch to prepared parameterized command, it
would be way faster.

Or use DataAdaper, it would generate parameterized insert command for you.
SP is not needed for that though you can still use it.


--
Best regards,

Ilya

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

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

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

Back
Top