Using DAO with MS SQL Server 7.0 
Author Message
 Using DAO with MS SQL Server 7.0

I have a VC++ 6.0 application that currently uses DAO to access an MS
Access 97 database.

We are looking to switch to a client/server database using MS SQL
Server 7.0.  I would like to make the least code changes as possible,
so I was looking into using ODBCDirect to access the SQL Server
database.

I installed the DAO SDK from the VC++ CDs, and have compiled the
application successfully.  The problem occurs when I try to run the
application.  The program crashes when it tries to connect to the SQL
Server database.  I added an entry in the ODBC Data Sources in the
Control Panel for the database and am using the following code to
access the database:

// Create connection
CString sConnectString;
sConnectString.Format("ODBC;DSN=%s;UID=%s;PWD=%s;DATABASE=dbName;",
m_sDSN, m_sUsername, m_sPassword);

m_Workspace = m_Engine.CreateWorkspace("Database", m_sUsername,
m_sPassword, dbUseODBC);
m_Connection = m_Engine.OpenConnection("Database", dbDriverNoPrompt,
FALSE, sConnectString);

It crashes on the CreateWorkspace call, in the objcore.cpp file in the
CRuntimeClass::IsDerivedFrom function.  I also tried compiling and
running one of the samples that came with the DAO SDK, and althgough
this also compiles successfully, it also crashes in the same exact spot
as my application.

Has anyone experienced this problem?  Does anyone have any ideas on
what may be the problem?  Any help would be appreciated.  Thanks.

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



Mon, 05 Aug 2002 03:00:00 GMT  
 Using DAO with MS SQL Server 7.0
I think you have to open the connection first before you can create a
workspace.


Quote:
> I have a VC++ 6.0 application that currently uses DAO to access an MS
> Access 97 database.

> We are looking to switch to a client/server database using MS SQL
> Server 7.0.  I would like to make the least code changes as possible,
> so I was looking into using ODBCDirect to access the SQL Server
> database.

> I installed the DAO SDK from the VC++ CDs, and have compiled the
> application successfully.  The problem occurs when I try to run the
> application.  The program crashes when it tries to connect to the SQL
> Server database.  I added an entry in the ODBC Data Sources in the
> Control Panel for the database and am using the following code to
> access the database:

> // Create connection
> CString sConnectString;
> sConnectString.Format("ODBC;DSN=%s;UID=%s;PWD=%s;DATABASE=dbName;",
> m_sDSN, m_sUsername, m_sPassword);

> m_Workspace = m_Engine.CreateWorkspace("Database", m_sUsername,
> m_sPassword, dbUseODBC);
> m_Connection = m_Engine.OpenConnection("Database", dbDriverNoPrompt,
> FALSE, sConnectString);

> It crashes on the CreateWorkspace call, in the objcore.cpp file in the
> CRuntimeClass::IsDerivedFrom function.  I also tried compiling and
> running one of the samples that came with the DAO SDK, and althgough
> this also compiles successfully, it also crashes in the same exact spot
> as my application.

> Has anyone experienced this problem?  Does anyone have any ideas on
> what may be the problem?  Any help would be appreciated.  Thanks.

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



Tue, 06 Aug 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Perform SQL statement in VC++ against MS SQL Server 7.0

2. OLEDB consumer: IRowsetIndex and MS SQL Server 7.0

3. Visual C++, ODBC and MS SQL Server 7.0

4. Visual C++, ODBC, and MS SQL Server 7.0

5. Visual C++, ODBC and MS SQL Server 7.0

6. Moving from JET to SQL Server / MSDE using DAO sdk

7. sqloledb.h from MS SQL 7.0

8. Keeping Cursor Open After a RollBack (MFC,ODBC,SQL Server 7.0)

9. HELP !!!! Developing a provider for SQL-Server 7.0

10. CRecordset updateable join with SQL Server 7.0

11. FS: "Professional SQL Server 7.0 Programming"

12. sysindexes problem in ADO with SQL Server 7.0

 

 
Powered by phpBB® Forum Software