CDatabase & CRecordset problem 
Author Message
 CDatabase & CRecordset problem

Hi everyone

I am building (or trying to build) a database application that is
supposed to connect to database via ODBC. Since I don't want to see the
nice ODBC login dialog, I've tried to use CDatabase class.
It is something like:

m_dbCust.OpenEx( _T( "DSN=something;UID=something;PWD=something")
CDatabase::noOdbcDialog );

then I have to create recordset

if (rs == NULL)
{
  ((CDbaseApp *)AfxGetApp())->rs = new CMyRecSet(&m_dbCust);
  ((CDbaseApp *)AfxGetApp())->rs->Open();

Quote:
}

until now it seems to work, but when I try to Move through the
recordset, it is  OK only for the MoveNext!?  When it is MoveLast,
MovePrev, or anything else there is

Unhandled exception in dddbase.exe (KERNEL32.DLL): 0xE06D7363: Microsoft
C++ Exception.

error message. Could someone tell me what have I done wrong. This is
killing me, so I will appreciate any help.

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Fri, 26 Jul 2002 03:00:00 GMT  
 CDatabase & CRecordset problem

Quote:

> Hi everyone

> I am building (or trying to build) a database application that is
> supposed to connect to database via ODBC. Since I don't want to see the
> nice ODBC login dialog, I've tried to use CDatabase class.
> It is something like:

What is it about the CRecordset calls that create the login?  I don't
have that and I *only* use CDatabase to ExecuteSQL(), accessing it
through CRecordset::m_pDatabase.  It sounds like some access protection
in your database.

Quote:
> m_dbCust.OpenEx( _T( "DSN=something;UID=something;PWD=something")
> CDatabase::noOdbcDialog );

> then I have to create recordset

> if (rs == NULL)
> {
>   ((CDbaseApp *)AfxGetApp())->rs = new CMyRecSet(&m_dbCust);
>   ((CDbaseApp *)AfxGetApp())->rs->Open();
> }

> until now it seems to work, but when I try to Move through the
> recordset, it is  OK only for the MoveNext!?  When it is MoveLast,
> MovePrev, or anything else there is

> Unhandled exception in dddbase.exe (KERNEL32.DLL): 0xE06D7363: Microsoft
> C++ Exception.

> error message. Could someone tell me what have I done wrong. This is
> killing me, so I will appreciate any help.

If you click "Retry" in the Assert dialog (running your Debug build), it
should take you to the line of code ASSERTing.  This will give you a
clue as to what MFC/ODBC is complaining about.

Check your open parameters.  There are cursor types that only permit
forward scrolling through the recordset.  In fact, "forwardonly" sounds
like it would be one of them.  I've only used dynasets and snapshots
myself.

--
Lynn Wallace                          http://www.xmission.com/~lawall
Be patient!  It took us forty million years for us to develop a thumb.
 It'll probably take us forty million years to get it out of our ass.



Fri, 26 Jul 2002 03:00:00 GMT  
 CDatabase & CRecordset problem


Fri, 19 Jun 1992 00:00:00 GMT  
 CDatabase & CRecordset problem
Thanks Raptor

First something about the environment. It is NT 4.0, VC++ 6.0 and
connection to Oracle 7.3 and MYSQL (choice is up to user) via ODBC
drivers. And yes, this was not my idea.

In the meantime I've managed to solve the problem.Its not that I'm much
cleverer now but this helped:

Opening database with

m_dbCust.OpenEx( _T( "DSN=something;UID=something;PWD=something"),
CDatabase::noOdbcDialog | CDatabase::useCursorLib)

and Recordsets with

((CDbaseApp *)AfxGetApp())->rs->Open(CRecordset::snapshot);
...
solved my problem. Now I have a lot of other problems but that's
programmers life.
So you could hear more from me soon.
Thanks again


Quote:

> > Hi everyone

> > I am building (or trying to build) a database application that is
> > supposed to connect to database via ODBC. Since I don't want to see
the
> > nice ODBC login dialog, I've tried to use CDatabase class.
> > It is something like:

> What is it about the CRecordset calls that create the login?  I don't
> have that and I *only* use CDatabase to ExecuteSQL(), accessing it
> through CRecordset::m_pDatabase.  It sounds like some access
protection
> in your database.

> > m_dbCust.OpenEx( _T( "DSN=something;UID=something;PWD=something")
> > CDatabase::noOdbcDialog );

> > then I have to create recordset

> > if (rs == NULL)
> > {
> >   ((CDbaseApp *)AfxGetApp())->rs = new CMyRecSet(&m_dbCust);
> >   ((CDbaseApp *)AfxGetApp())->rs->Open();
> > }

> > until now it seems to work, but when I try to Move through the
> > recordset, it is  OK only for the MoveNext!?  When it is MoveLast,
> > MovePrev, or anything else there is

> > Unhandled exception in dddbase.exe (KERNEL32.DLL): 0xE06D7363:
Microsoft
> > C++ Exception.

> > error message. Could someone tell me what have I done wrong. This is
> > killing me, so I will appreciate any help.

> If you click "Retry" in the Assert dialog (running your Debug build),
it
> should take you to the line of code ASSERTing.  This will give you a
> clue as to what MFC/ODBC is complaining about.

> Check your open parameters.  There are cursor types that only permit
> forward scrolling through the recordset.  In fact, "forwardonly"
sounds
> like it would be one of them.  I've only used dynasets and snapshots
> myself.

> --
> Lynn Wallace                          http://www.xmission.com/~lawall
> Be patient!  It took us forty million years for us to develop a thumb.
>  It'll probably take us forty million years to get it out of our ass.

Sent via Deja.com http://www.deja.com/
Before you buy.


Sat, 27 Jul 2002 03:00:00 GMT  
 CDatabase & CRecordset problem


Fri, 19 Jun 1992 00:00:00 GMT  
 CDatabase & CRecordset problem
Have a look at the sort of cursor you have. That sounds as if you have a
forward only cursor and so doesn't support MoveFirst or MoveLast. I've found
a similar thing using an SQL Server data source and found that I could get
it to work if I didn't load the cursor library.

Brendan Brolly
HET Software

Quote:

> Hi everyone

> I am building (or trying to build) a database application that is
> supposed to connect to database via ODBC. Since I don't want to see the
> nice ODBC login dialog, I've tried to use CDatabase class.
> It is something like:

> m_dbCust.OpenEx( _T( "DSN=something;UID=something;PWD=something")
> CDatabase::noOdbcDialog );

> then I have to create recordset

> if (rs == NULL)
> {
>   ((CDbaseApp *)AfxGetApp())->rs = new CMyRecSet(&m_dbCust);
>   ((CDbaseApp *)AfxGetApp())->rs->Open();
> }

> until now it seems to work, but when I try to Move through the
> recordset, it is  OK only for the MoveNext!?  When it is MoveLast,
> MovePrev, or anything else there is

> Unhandled exception in dddbase.exe (KERNEL32.DLL): 0xE06D7363: Microsoft
> C++ Exception.

> error message. Could someone tell me what have I done wrong. This is
> killing me, so I will appreciate any help.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sat, 27 Jul 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. CDatabase & CRecordset

2. Problem with Access 2000 and CDatabase/CRecordset

3. sos, urgent problem about CRecordset and CDatabase;

4. CRecordset and CDatabase problem

5. sos, urgent problem about CRecordset and CDatabase;

6. Problems with CDatabase and CRecordset in non-mfc project

7. CDatabase vs CRecordset

8. CRecordset/CDatabase broken by ODBC 3.5?

9. CDatabase, CRecordset in a service or console program.

10. CDatabase , CRecordSet and Oracle DSN!

11. Passing CDatabase Pointer to CRecordset Constructor

12. SQL Server with CDatabase/CRecordset and server cursors

 

 
Powered by phpBB® Forum Software