Solved

Multiple Connetions in VB.NET SQL Stored Procdure

Posted on 2007-04-09
2
176 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
2 Comments
 
LVL 142

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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

709 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now