Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLConfigDataSource problem
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00111019
Message ID:
00111044
Views:
27
>>>Any ideas on why the following is failing (returns 0)?
>>>DECLARE Integer SQLConfigDataSource in odbccp32 ;
>>>   Integer, Integer, String, String
>>>lcODBCDriver="MSORCL32"
>>>lcSettings="DSN=Locator"+chr(0)+;
>>>           "Description=Region 6 Locator"+chr(0)+;
>>>           "Server=Reg6"+chr(0)+;
>>>           "UID=Reader"
>>>lnSuccess=SQLConfigDataSource(0, 1, lcODBCDriver, lcSettings)
>>>return lnSuccess
>>>
>>>This is trying to setup a new DSN with the 32-bit MS ODBC drivers for Oracle
>>>
>>>TIA
>>Mark,
>>
>>In the function declaration, does it return a BOOL or a DWORD. If it's a BOOL then 0 does indeed mean that the function failed. However, many functions return 0 (ERROR_SUCCESS) if they're not returning handles, etc.
>
>My guess is it is returning Bool -- I go into Win 95 registry and/or ODBC Mgr and the entry does not appear, therefore it has failed to be created.
>
>I have done this in the past, and it worked. I am stumped as to where to go from here. I can *manually* add the new DSN via the 32-bit ODBC Manager. But I want to be able to programmatically create the DSN if it does not exist on a user's computer. I have been able to check successfully for the existence (or not) of a DSN.

Without the declaration, it's pretty much of a guess, unless there's an error that a function like GetLastError() would return. Quite possibly it's expecting so of those values to be passed by reference rather than value. That might cause it as well.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform