473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Disconnected ADO recordsets lose their data

I keep having problems in which ADO disconnected recordset work under some
circumstances, but lose all their data at other times, having no rows or
fields, though the recordset object still exists.

One case where this happened to me today was in trying to store disconnected
recordsets in a cache collection in case they are needed again later in the
same session. When I retrieve the recordset from the collection, it's empty.
On the other hand, the same disconnected recordset worked fine being passed
around and used right after it was created, and prior to pulling it out of the
cache later.

I've been able to work around this problem by saving the recordsets to stream
objects (in memory, not bound to files), and storing the streams in the cache
instead of the recordsets themselves, but I don't know why streams survive
caching, and raw disconnected recordsets do not.
Nov 13 '05 #1
6 2914
On Jun 02 2004, 12:56 am, Steve Jorgensen <no****@nospam.nospam> wrote
in news:l6********************************@4ax.com:
I keep having problems in which ADO disconnected recordset work under
some circumstances, but lose all their data at other times, having no
rows or fields, though the recordset object still exists.

One case where this happened to me today was in trying to store
disconnected recordsets in a cache collection in case they are needed
again later in the same session. When I retrieve the recordset from
the collection, it's empty. On the other hand, the same disconnected
recordset worked fine being passed around and used right after it was
created, and prior to pulling it out of the cache later.

I've been able to work around this problem by saving the recordsets to
stream objects (in memory, not bound to files), and storing the
streams in the cache instead of the recordsets themselves, but I don't
know why streams survive caching, and raw disconnected recordsets do
not.


I haven't seen this, but please post back if you find more about it. Which
version of ADO is this? Does it happen only to recordsets that you store in
cache?

--
remove a 9 to reply by email
Nov 13 '05 #2
Steve Jorgensen <no****@nospam.nospam> wrote in
news:l6********************************@4ax.com:
I keep having problems in which ADO disconnected recordset work
under some circumstances, but lose all their data at other times,
having no rows or fields, though the recordset object still
exists.


Are you absolutely certain the recordset is not getting wiped? I've
had issues where recordset that are supposed to be initialized ended
up not initialized, and it ended up being because code elsewhere had
de-initialized the database variable that was the parent of the
recordset. It was a mistake in my code, obviously, but it's pretty
easy to do by accident.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3
On Wed, 02 Jun 2004 12:11:27 -0000, Dimitri Furman <df*****@cloud99.net>
wrote:
On Jun 02 2004, 12:56 am, Steve Jorgensen <no****@nospam.nospam> wrote
in news:l6********************************@4ax.com:
I keep having problems in which ADO disconnected recordset work under
some circumstances, but lose all their data at other times, having no
rows or fields, though the recordset object still exists.

One case where this happened to me today was in trying to store
disconnected recordsets in a cache collection in case they are needed
again later in the same session. When I retrieve the recordset from
the collection, it's empty. On the other hand, the same disconnected
recordset worked fine being passed around and used right after it was
created, and prior to pulling it out of the cache later.

I've been able to work around this problem by saving the recordsets to
stream objects (in memory, not bound to files), and storing the
streams in the cache instead of the recordsets themselves, but I don't
know why streams survive caching, and raw disconnected recordsets do
not.


I haven't seen this, but please post back if you find more about it. Which
version of ADO is this? Does it happen only to recordsets that you store in
cache?


In this app, it only happens to idems I store in the cache. I've also seen it
happen in other apps when I do things like try to return a disconnected
recordset via a reference parameter. I'm not sure if that's consistent,
though.
Nov 13 '05 #4
On Wed, 02 Jun 2004 15:13:56 GMT, "David W. Fenton"
<dX********@bway.net.invalid> wrote:
Steve Jorgensen <no****@nospam.nospam> wrote in
news:l6********************************@4ax.com :
I keep having problems in which ADO disconnected recordset work
under some circumstances, but lose all their data at other times,
having no rows or fields, though the recordset object still
exists.


Are you absolutely certain the recordset is not getting wiped? I've
had issues where recordset that are supposed to be initialized ended
up not initialized, and it ended up being because code elsewhere had
de-initialized the database variable that was the parent of the
recordset. It was a mistake in my code, obviously, but it's pretty
easy to do by accident.


Since this is ADO, and the recordset is disconnected from the database, it
-should- no longer be dependent on whether the original connection has been
closed. It is true, though, that the connection may have been closed and
reopened when this symptom appears, so I could test to see if that's what is
causing the problem.
Nov 13 '05 #5
Steve Jorgensen <no****@nospam.nospam> wrote in
news:hn********************************@4ax.com:

In this app, it only happens to idems I store in the cache. I've also
seen it happen in other apps when I do things like try to return a
disconnected recordset via a reference parameter. I'm not sure if
that's consistent, though.


Tell us about the cache, please.

--
Lyle
(for e-mail refer to http://ffdba.com/)
Nov 13 '05 #6
On 2 Jun 2004 15:48:54 GMT, Lyle Fairfield <Mi************@Invalid.Com> wrote:
Steve Jorgensen <no****@nospam.nospam> wrote in
news:hn********************************@4ax.com :

In this app, it only happens to idems I store in the cache. I've also
seen it happen in other apps when I do things like try to return a
disconnected recordset via a reference parameter. I'm not sure if
that's consistent, though.


Tell us about the cache, please.


Each time the application (actually, an ActiveX DLL used by several
applications) opens a recordset, it does so by calling a function that opens
the recordset, disconnects it by setting its ActiveConnection to Nothing, then
returns it to the calling code. So far, so good because the first pass works.

The code that calls the routine described above generates a key string based
on which query is being run and what parameters are being used, and tries to
retrieve a recordset from a VBA collection acting as the cache. If a
recordset is returned, that means it was previously cached and doesn't have to
be queried again. If there was no recordset in the cache with that key, the
procedure described above is called, then the recordset is added to the cache
collection using the generated key string, so it canb e found in the cache
next time.

When I tested this, the code was breaking on the second pass for the same
query/criteria because a recordset was returned from the cache, but it was
empty and had no fields. After I changed the cache code to persist the
recordset into a stream object and cache that, then open a new recordset from
the stream when found in the cache later, the code started working properly.
Nov 13 '05 #7

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

Similar topics

1
by: lakshmi | last post by:
Hi all, I recently rewrote a data intensive C++ program in C#. The C++ program was traversing 3 recordsets that were all open at the same time. I replaced those 3 recordsets with 3 .NET data...
1
by: Andrew | last post by:
I'm a long time VB6/ADO and Java developer new to ADO.NET. I'm trying to decide on best practices and I'd appreciate any assistance. I have one specific question and another more general...
2
by: Eric Peterson | last post by:
I use the shape object to make recordsets that have no db connection for use in grids and such. For example (mPhoneNumbersRS as ADODB.Recordset) ****************************************...
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 asked about how to accomplish same with Oracle and...
9
by: Steven Nagy | last post by:
I know that .NET is based on a disconnected architecture, but I can't conceive of why continually opening and closing a connection would be faster than leaving a connection open. So I ran a test...
24
by: Donald Grove | last post by:
I want to populate an array with values from an ado recordset (multiple rows) I use the absolute position of the cursor in the recordset to define the row of my array to be populated. I have a...
2
by: campbell_canuck | last post by:
I'm hoping to get a little advice. I currently have a repository db that is located on a server. There are a number of client databases that have their own interfaces (forms, reports, queries)...
4
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I...
1
by: Arpan | last post by:
Recently in an interview (for the post of ASP programmer), I was asked "How do you define disconnected recordset in ASP". I was stumped & couldn't answer. What's the answer to the question? Is it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.