472,333 Members | 1,112 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

Multiple Recordsets with VB Net

Hi, hope someone can help.

I'm writing a decent size app as a first project in Net, have been writing
in VB for years.

I've stumbled on a small problem, I can't open two connections to a database
at the same time, even if the connections are in different classes. Am I
doing something compeltely idiotic or is this not as easy at it used to be?

Cheers,
Tull.
Nov 21 '05 #1
8 6575
Why can't you open 2 connections at the same time?

We can't say what you might be doing wrong, if you don't show us your code.

Also, do you really need 2 open connection? You can open the connection, get
the data into a datatable, and close it. And then open it again when you
need more data.

"Tull Clancey" <tu**********@btopenworld.com> wrote in message
news:d6**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi, hope someone can help.

I'm writing a decent size app as a first project in Net, have been writing
in VB for years.

I've stumbled on a small problem, I can't open two connections to a
database at the same time, even if the connections are in different
classes. Am I doing something compeltely idiotic or is this not as easy
at it used to be?

Cheers,
Tull.

Nov 21 '05 #2
Sorry I haven't posted code, I'm using the basic OLEDB connection and
the DataReader, DataAdapter etc. objects.

When I try to open a second DataReader or Adapter I'm told that a
connection is already made and I can't make another.

Going back to DAO and ADO you could open one database connection and as
many recordsets as required.

The reason is I have to open a couple of tables and write values to
another at the same time, SQL joining just wont do the trick.

Cheers,
Tull.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #3

"Tull Clancey" <tu**********@btopenworld.com> wrote in message
news:d6**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
Hi, hope someone can help.

I'm writing a decent size app as a first project in Net, have been writing
in VB for years.

I've stumbled on a small problem, I can't open two connections to a
database at the same time, even if the connections are in different
classes. Am I doing something compeltely idiotic or is this not as easy
at it used to be?

Cheers,
Tull.

Based on your reference to the term "Recordsets" in the subject line, are
you attempting to use ADO with this project, or are you trying to use
ADO.NET? Once we get that settled, can you provide some specifics?
Are you attempting to create the connections at design time, using Server
Explorer or in code? Can you quote the error message received when you
attempt to open the second connection?

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Nov 21 '05 #4
Is this for access? Then that is probably a limitation of the database
engine.

Like I said, I am assuming by 'record set', you mean an OleDbDataReader, in
which case, you might need to switch to using datatables. That way you can
execute one query, get a result set, and then execute another query, and get
another result set, and look at them both at the same time.

"Tull Clancey" <tu**@idcodeware.co.uk> wrote in message
news:u%****************@TK2MSFTNGP10.phx.gbl...
Sorry I haven't posted code, I'm using the basic OLEDB connection and
the DataReader, DataAdapter etc. objects.

When I try to open a second DataReader or Adapter I'm told that a
connection is already made and I can't make another.

Going back to DAO and ADO you could open one database connection and as
many recordsets as required.

The reason is I have to open a couple of tables and write values to
another at the same time, SQL joining just wont do the trick.

Cheers,
Tull.

*** Sent via Developersdex http://www.developersdex.com ***

Nov 21 '05 #5
Tull,

From this message it sounds like the error is that you can't have more than
1 datareader open on any given open connection. (Not that your app can't have
more than one open connection).

It is the case that only one datareader can be open on a connection at a
time. That's probably also the case with the data adapter.

Kerry Moorman
"Tull Clancey" wrote:
Sorry I haven't posted code, I'm using the basic OLEDB connection and
the DataReader, DataAdapter etc. objects.

When I try to open a second DataReader or Adapter I'm told that a
connection is already made and I can't make another.

Going back to DAO and ADO you could open one database connection and as
many recordsets as required.

The reason is I have to open a couple of tables and write values to
another at the same time, SQL joining just wont do the trick.

Cheers,
Tull.

*** Sent via Developersdex http://www.developersdex.com ***

Nov 21 '05 #6
Kerry,
It is the case that only one datareader can be open on a connection at a
time. That's probably also the case with the data adapter.


The Dataadapter uses internally the datareader to gets its rows.

Just to inform you that you are rigth,

Cor
Nov 21 '05 #7
Tull,
It sounds like you are using a single OleDbConnection object, and attempting
to use multiple OleDbDataReader objects.

You can only have a single DataReader object in use for each Connection
object.

If you in deed want multiple connections open at the same then, then you
need to create multiple OleDbConnection objects.

Hope this helps
Jay

"Tull Clancey" <tu**@idcodeware.co.uk> wrote in message
news:u%****************@TK2MSFTNGP10.phx.gbl...
| Sorry I haven't posted code, I'm using the basic OLEDB connection and
| the DataReader, DataAdapter etc. objects.
|
| When I try to open a second DataReader or Adapter I'm told that a
| connection is already made and I can't make another.
|
| Going back to DAO and ADO you could open one database connection and as
| many recordsets as required.
|
| The reason is I have to open a couple of tables and write values to
| another at the same time, SQL joining just wont do the trick.
|
| Cheers,
| Tull.
|
| *** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #8
Many thanks, I think you have set me off in the right direction.

Thanks again.
Cheers,
Tull.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: (Pete Cresswell) | last post by:
I posted this in the MS Access group, but no luck. ------------------------------------------ I've got another stored procedure in the same app...
3
by: sans_spam | last post by:
I want to pull 2 different recordsets using 2 different stored procedures using the same Data Connection. Below is the code that I currently have,...
2
by: Keith Chadwick | last post by:
I prefer to use stored procedures over having sql statements sitting in my ..NET code. My problem is I can not figure out how get .NET to...
12
by: Scott | last post by:
Front-end Access 2000 I have a stored procedure that has 2 parameters BusinessUnitID and Year. It returns multiple record sets (5 to be exact)....
16
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I...
6
by: blue875 | last post by:
Hello helper people who are smarter than me: I have a form that needs to submit multiple queries to different tables during one Sub's execution. ...
0
by: nachiket2k2 | last post by:
Hi, I am using VB 6.0, ADO 2.0 with MS Access 2000 Database. in a vb form, i need to fatch data from 3 different tables (ABC.MDB). it will be a...
3
by: Dooza | last post by:
Hi there, I have a Stored Procedure in SQL 2000 that takes 10 input paremeters, and outputs 11 recordsets, not rows, but 11 different SELECT...
0
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.