I am using OleDB for executing my queries in C#,
Is there any way I can execute multiple queries in one command statement?
I tried to separate them with semi-colon (;) but it gives error “Characters found at the end”
I have to execute a few hundreds of queries at once.
Edit: I am executing Insert Statements.
It’s not possible to combine queries within one
OleDbCommand. If possible, make a stored procedure, otherwise you’ll have to stick to firing many OleDbCommands at the server.It’s worth noting, though, that connection pooling is enabled for
OleDbConnectionby default:EDIT:
Try something like this:
Depending on which OleDb provider you’re connecting to, you might be able to use this. But beware, it might be as slow as inserting records one by one anyway.