-
November 26th, 2015, 09:49 PM
#1
ODBC COnfiguration issue
Hi,
I am trying to call SQLConfigDataSource() in my program, but apparently I receive the following:
The setup routines for the D ODBC driver could not be found. Please reinstall the driver.
This is the code:
Code:
wcscpy( buf, L"Driver = " );
wcscat( buf, driverName );
ret = sqlConfigDataSource( handle, ODBC_ADD_DSN, const_cast<SQLWCHAR *>( driverName ), buf );
if( ret != SQL_SUCCESS )
{
result = false;
while( ( ret = sqlGetDiag( SQL_HANDLE_ENV, env, i, sqlState, &nativeError, errMsg, sizeof( errMsg ), &cbErrorMsg ) ) == SQL_SUCCESS )
{
errorMsg.push_back( errMsg );
i++;
}
}
Looking under the debugger, the value of 'ret' is 0, which SQL_SUCCESS. The value of 'driverName' is "Driver da Microsoft para arquivos texto (*.txt)".
The window handle passed is correct.
Trying to execute ODBC Administrator program from the Control Panel for this driver correctly produces the setup dialog.
Is there a reason why I get the "D" as the driver name, and the function 'fails'?
This is on Windows 8.1 with MSVC 2010.
Thank you.
-
November 27th, 2015, 04:06 AM
#2
Re: ODBC COnfiguration issue
Not sure what sqlConfigDataSource may be, but
Code:
// C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\odbcinst.h
BOOL INSTAPI SQLConfigDataSource (HWND hwndParent,
WORD fRequest,
LPCSTR lpszDriver,
LPCSTR lpszAttributes);
The function accepts ANSI string for lpszDriver. As long as you pass L"Driver = " no surprise it appears to be just D in the call.
Best regards,
Igor
-
November 27th, 2015, 06:34 PM
#3
Re: ODBC COnfiguration issue
Igor,
I'm passing (SQLWCHAR *) to the function.
So let me try with LPCSTR...
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|