Solved

Multiple Connetions in VB.NET SQL Stored Procdure

Posted on 2007-04-09
2
181 Views
Last Modified: 2012-05-05
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
Comment
Question by:randymiller
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18880715
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
 
LVL 3

Expert Comment

by:JipFromParis
ID: 18890966
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question