Hi Kim,

> -----Original Message-----
> From: DongAh, Kim [mailto:[EMAIL PROTECTED]]
> Sent: Montag, 2. Dezember 2002 20:41
> To: [EMAIL PROTECTED]
> Subject: SQLConnectW return -2
> 
> 
> Hi!
> 
> In VC++ define _UNICODE and run this code :
> 
> // Allocate the Environment Handle
>   sqlRetcode = SQLAllocHandle(SQL_HANDLE_ENV,
>         SQL_NULL_HANDLE,
>         &m_hEnv );
> 

I think you have to set the environment attribute, whether
you want to do ODBC-Ver 2 or 3. Furthermore it is a good idea
to check the return code after the allocation calls.

>  // Allocate the Connection handle
>  sqlRetcode = SQLAllocHandle(SQL_HANDLE_DBC,
>         m_hEnv,
>         &m_hDbc );
> 
> sqlRetcode = SQLConnect( m_hDbc,
>          _T("dsn_name"),
>          SQL_NTS,
>          _T("uid"),
>          SQL_NTS,
>          _T("pwd"),
>          SQL_NTS);
> 
>   if (sqlRetcode != SQL_SUCCESS) {
>    GetDBError(SQL_HANDLE_DBC, m_hDbc);
>    return FALSE;
>   }
[snip]
> And I want to know that what files include and how setting library.

sqlucode.h. The ODBC driver contains both, ASCII and Unicode functions.
In case of Windows, always the Unicode API is used. If the application
is non Unicode, the driver manager maps the calls (see ODBC reference).


Regards  Thomas


----------------------------------------------
Dr. Thomas K�tter
SAP DB, SAP Labs Berlin


SAP DB is open source. Get it!    www.sapdb.org 


 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to