• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Multiple Connetions in VB.NET SQL Stored Procdure

I am writing a SQL stored procedure in vb.net and having problem with the
context connection=true

It seems that you can only do one thing at a time, while what I am looking to do it loop through one file and update a field with an update at the same time.

I have the connection with the data reader with no problem, but what about the update command, what connection does that use? Do I just use a new connection in the traditional way without the connection=true?

Seems like there should be a better way.

Thanks
Randy Miller
0
randymiller
Asked:
randymiller
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
what kind of update will it be?
you might be able to run a UPDATE statement directly instead of doing a SELECT + UPDATE rowbased.

otherwise, you will have to complete to read the entire datareader (for example, into an array), close the data reader, and then  run the update statement looping on the array items.

CHeers
0
 
JipFromParisCommented:
angelIII suggestion is great. If you can perform a single update, do it. Otherwise you will have to open a new regular connection because multiple instances of the context connection can't coexist in a single connection context, neither do multiple active result set (MARS).
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now