Hi,
How to execute multiple queries with one connection in vb.net.
I am using windows vb.net with Access DB.
In my project i need to delete the records of 15 tables.
Every time i need to open the connection and close the connection for every delete statement.
Same way i need to insert the records for 15 to 20 tables.
It took lot of time to execute.
is it possible to delete the records from multiple tables with one connections?
Need code for this
Sucharitha
Loading

Kunal VaishyaRank #990 · 2K reputationPosted Jul 17, 2013, 4:01 AM EDT
you can set multiple Query for delete in one command in Command Text
Refer this link for More
http://www.codeproject.com/Articles/306722/Executing-multiple-SQL-statements-as-one-against-S
suchi rana18 reputationPosted Jul 17, 2013, 4:07 AM EDT
Vikash Mahata4 reputationPosted Jul 17, 2013, 11:17 AM EDT
Try like this:
Try
conn.Open()
cmd1.ExecuteNonQuery()
cmd2.ExecuteNonQuery()
cmd3.ExecuteNonQuery()
cmd4.ExecuteNonQuery()
...............................
................................
cmd15.ExecuteNonQuery()
conn.Close()
Catch ex As Exception
End Try
Hemant SrivastavaRank #581 · 4.2K reputationPosted Jul 17, 2013, 12:42 PM EDT