Using a single database connection to access multiple snapshot recordsets 
Author Message
 Using a single database connection to access multiple snapshot recordsets

I am getting a KERNEL32.DLL exception after I do the following:

Open a single database connection using CDatabase::useCursorLib.
Define two recordsets (recordset1 and recordset2) and set their m_pDatabase
to share the single database connection.

Open recordset1 using CRecordset::snapshot,
Open recordset2 using CRecordset::snapshot.

Then fill the first recordset with:
while (!recordset1.IsEOF())
        recordset1.MoveNext();

When I hit the EOF, I get a KERNEL32.DLL exception.

It seems to work fine if I use a dynaset or if I open the recordset and
then read the whole table before I open the second recordset.  Should I be
able to do this??  Thanx for any help.



Sun, 23 Jul 2000 03:00:00 GMT  
 Using a single database connection to access multiple snapshot recordsets

Quote:

>I am getting a KERNEL32.DLL exception after I do the following:

>Open a single database connection using CDatabase::useCursorLib.
>Define two recordsets (recordset1 and recordset2) and set their m_pDatabase
>to share the single database connection.

>Open recordset1 using CRecordset::snapshot,
>Open recordset2 using CRecordset::snapshot.

>Then fill the first recordset with:
>while (!recordset1.IsEOF())
> recordset1.MoveNext();

>When I hit the EOF, I get a KERNEL32.DLL exception.

You should be able to do this. I have an even more complicated situation
than yours, with dynamically created recordsets, and transient recordset, of
several different tables in the database, all working off of a single
database object.

When you say "set their m_pDatabase to share the connection", do you set
that when you create the recordsets, or do you explicitly set m_pDatabase? I
don't explicitly set them in my code, and if you do, that could be causing
the problem.

-- Agent



Sat, 05 Aug 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using a single database connection to access multiple snapshot recordsets

2. using multiple tables in a single access database

3. Using Multiple Views with a Single Recordset

4. using multiple ADO Connections with the same database

5. Connection to Database from multiple processes using OLE DB

6. DATABASE ACCESS USING RECORDSET & NO RECORDVIEW

7. problems using Access database with multiple threads.

8. problems using Access database with multiple threads.

9. Multiple threads doing database access using CRecordset

10. problems using Access database with multiple threads.

11. Single ODBC connection for multiple processes

12. Read multiple recordset with one connection

 

 
Powered by phpBB® Forum Software