Solved

Multiple Connetions in VB.NET SQL Stored Procdure

Posted on 2007-04-09
2
177 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Group by correlation 4 55
How to enforce inte 8 43
How to simplify my SQL statement? 14 50
Strange msg in the SSMS pane 13 49
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…
In this article I will describe the Backup & Restore 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.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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

14 Experts available now in Live!

Get 1:1 Help Now