|
 |
ado_dotnet thread: Datasets per Connection
Message #1 by "Marl Atkins" <marl@s...> on Tue, 12 Nov 2002 17:14:05
|
|
Hi:
I'm trying to open a couple simple recordsets (excuse me, DataSets) using
the new ADO.NET.
When I try to open the second one I get an error:
System.InvalidOperationException: There is already an open DataReader
associated with this Connection which must be closed first.
Does this mean that I have to open a seperate connection for every single
DataSet
Yea, it says DataReader.
Ideally, I'd like to open 2 DataReader objects but after I got the error
the first time I tried to open a DataReader then a DataSet using the same
Connection object.
How am I supposed to do this??
So far I don't like ADO.NET at all. It's much more difficult and it's lost
functionality (like Find).
Message #2 by "Brian Smith" <bsmith@l...> on Wed, 13 Nov 2002 09:11:33 -0000
|
|
Marl,
DataReaders are meant to be consumed quickly and discarded, since you
are allowed only one DataReader per Connection and it will block any
other data access. DataSets are filled by DataAdapters that use a
DataReader under the hood, hence the error.
You'll find ADO.Net much better than ADO, but it takes time to learn how
to drive it... :-)
brian
-----Original Message-----
From: Marl Atkins [mailto:marl@s...]
Sent: Tue, 12 Nov 2002 17:14
To: ADO.NET
Subject: [ado_dotnet] Datasets per Connection
Hi:
I'm trying to open a couple simple recordsets (excuse me, DataSets)
using
the new ADO.NET.
When I try to open the second one I get an error:
System.InvalidOperationException: There is already an open DataReader
associated with this Connection which must be closed first.
Does this mean that I have to open a seperate connection for every
single
DataSet
Yea, it says DataReader.
Ideally, I'd like to open 2 DataReader objects but after I got the error
the first time I tried to open a DataReader then a DataSet using the
same
Connection object.
How am I supposed to do this??
So far I don't like ADO.NET at all. It's much more difficult and it's
lost
functionality (like Find).
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/2002
Message #3 by "Marl Atkins" <marl@s...> on Wed, 13 Nov 2002 20:13:58
|
|
Thanks Brian:
I guess I'll use an array or a Dataset.
> Marl,
DataReaders are meant to be consumed quickly and discarded, since you
are allowed only one DataReader per Connection and it will block any
other data access. DataSets are filled by DataAdapters that use a
DataReader under the hood, hence the error.
You'll find ADO.Net much better than ADO, but it takes time to learn how
to drive it... :-)
brian
-----Original Message-----
From: Marl Atkins [mailto:marl@s...]
Sent: Tue, 12 Nov 2002 17:14
To: ADO.NET
Subject: [ado_dotnet] Datasets per Connection
Hi:
I'm trying to open a couple simple recordsets (excuse me, DataSets)
using
the new ADO.NET.
When I try to open the second one I get an error:
System.InvalidOperationException: There is already an open DataReader
associated with this Connection which must be closed first.
Does this mean that I have to open a seperate connection for every
single
DataSet
Yea, it says DataReader.
Ideally, I'd like to open 2 DataReader objects but after I got the error
the first time I tried to open a DataReader then a DataSet using the
same
Connection object.
How am I supposed to do this??
So far I don't like ADO.NET at all. It's much more difficult and it's
lost
functionality (like Find).
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/2002
Message #4 by Richard Ainsley <rainsley@p...> on Wed, 13 Nov 2002 23:08:36 -0800
|
|
Yes. The idea is a very small layer of code between your code and the data
provider. When the reader is open, the connection must also be open -- and
it is BUSY until you close your data reader. The unlike the data adapter, a
data reader doe snot automatically disconnect when it reaches the end
either... If you need something more disconected, use a DataAdapter
instead.
----- Original Message -----
From: "Marl Atkins" <marl@s...>
To: "ADO.NET" <ado_dotnet@p...>
Sent: Tuesday, November 12, 2002 5:14 PM
Subject: [ado_dotnet] Datasets per Connection
> Hi:
>
> I'm trying to open a couple simple recordsets (excuse me, DataSets) using
> the new ADO.NET.
>
> When I try to open the second one I get an error:
>
> System.InvalidOperationException: There is already an open DataReader
> associated with this Connection which must be closed first.
>
> Does this mean that I have to open a seperate connection for every single
> DataSet
>
> Yea, it says DataReader.
>
> Ideally, I'd like to open 2 DataReader objects but after I got the error
> the first time I tried to open a DataReader then a DataSet using the same
> Connection object.
>
> How am I supposed to do this??
>
> So far I don't like ADO.NET at all. It's much more difficult and it's lost
> functionality (like Find).
|
|
 |