RE: Visual C++ 6 and ODBC
- From: "David++" <David@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 7 Jun 2005 02:54:01 -0700
Hi there,
It is the same code it seems from VC++6 and .NET e.g.
where 'connect' is the connection string i.e. database name, username,
passowrd etc..
CDatabase db;
try
{
bSuccess = db.Open(connect);
if(!bSuccess)
{
AfxMessageBox( "DB Connection failed!" );
return;
}
}
catch(CDBException* pEx)
{
AfxMessageBox(pEx->m_strError);
pEx->Delete();
AfxMessageBox( "DB Connection failed!" );
return;
}
try
{
// Display Success
AfxMessageBox( "Connected to Database" );
}
catch (CDBException *pEx)
{
// The only exception we should get is an illegal SQL statement
AfxMessageBox(pEx->m_strError);
pEx->Delete();
AfxMessageBox("SQL Error!");
}
// Close Database
db.Close();
"David++" wrote:
> Hi folks,
>
> I'm writing to ask if anyione has any information on how to get an ODBC
> connection up and running under Visual C++ 6. I've been using Visual C++.NET
> and have managed to get a database connection up and running using the MFC
> ODBC Consumer in the Class Wizard. However, I think I might have to code the
> connection by hand in Visual C++ 6? I'm not sure of the possibilites of VC++6
> as I've been using .NET up till now and had to downgrade for thei particular
> project. Is it possible to use the same include files in VC++6 as used in
> .NET in order to use the Database connection classes and functions?
>
> Any tips or advice on how to get started are very much appreciated.
>
> Sincerely,
>
> David Ross
.
- Follow-Ups:
- Re: Visual C++ 6 and ODBC
- From: Joe Butler
- Re: Visual C++ 6 and ODBC
- References:
- Visual C++ 6 and ODBC
- From: David++
- Visual C++ 6 and ODBC
- Prev by Date: Visual C++ 6 and ODBC
- Next by Date: Re: Visual C++ 6 and ODBC
- Previous by thread: Visual C++ 6 and ODBC
- Next by thread: Re: Visual C++ 6 and ODBC
- Index(es):
Relevant Pages
|
Loading