473,757 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2947
On Jun 02 2004, 12:56 am, Steve Jorgensen <no****@nospam. nospam> wrote
in news:l6******** *************** *********@4ax.c om:
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.c om:
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*****@cloud9 9.net>
wrote:
On Jun 02 2004, 12:56 am, Steve Jorgensen <no****@nospam. nospam> wrote
in news:l6******** *************** *********@4ax.c om:
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********@bwa y.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.c om:

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 ActiveConnectio n 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
2075
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 readers and found that my C# code takes only about 35% of the time that the old C++ program took to execute. I'm amazed at this performance improvement, but finding it hard to believe. I'm supposed to make a recommendation based on my test results.
1
2141
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 architectural one: 1. How can you pass around a disconnected DataSet/DataTable, make changes to it and then pass it into a component for update? The disconnected DataSet doesn't know it's UPDATE statement and the DataAdapter is long since gone. 2....
2
2878
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) **************************************** mPhoneNumbersRS.let_ActiveConnection ("Provider=MSDataShape;Data Provider=none;Data Source=localhost;") sTmp = "SHAPE APPEND NEW adChar(20) as Type, NEW advarChar
16
5724
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 got a nudge in the right direction from Mr. Kreft. I promised to provide details once working, so here it is. The code is shown below. My next step is to build this technique into my application. I'm hoping for substantial performance gain. ...
9
1822
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 and came up with a result of exactly the same times! 50 rows selected into a datareader, in a loop of 50 One opens and closes the connection in each iteration of the loop, the other just opens before the loop starts, then closes after the loop is...
24
8506
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 workaround for lack of a way to define the ordinal position of a field (incrementing a counter variable), but it feels so primitive: dim Fld as Field dim rst1 as new adodb.recordset
2
1671
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) but use the repository db for storing data. There is a new requirement for some users to be able to upload limited and specific information to a laptop (or tablet), take it into a remote (ie disconnected) environment, and update the information....
4
1513
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 have a textbox for searching, a listbox to display the searched results, and a big textbox (memo) to display the clicked-results of the listbox item. My question is: should I load the controls with objects, and therefore store everything in...
1
2250
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 GetRows()? Thanks, Regards, AD
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.