Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Declare DLL error
Message
 
To
08/11/2002 10:44:37
Stephen Hunt
Admit Computer Services Inc.
Farmingdale, New York, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00720301
Message ID:
00720336
Views:
9
>In my application I use the odbccp32.dll to configure my ODBC settings programatically. The syntax is as follows
>
>DECLARE Integer SQLConfigDataSource in odbccp32.dll Integer, Integer,;
> String, String
>
> settings="DSN=acctpay"+chr(0)+;
> "Description=acctpay"+chr(0)+;
> "SourceDB="+SYS(5) + SYS(2003)+"\acctpay.dbc"+chr(0)+;
> "SourceType=DBC"
>
> SQLConfigDataSource(0,1,"Microsoft Visual FoxPro Driver",settings)
>
>Randomly I get an error 2027 "Declare DLL call caused an exception"
>I do not get the error all the time and seems to have just started happening over the past couple months.

Hi Stephen
Add the missing chr(0) after "SourceType=DBC". It may be causing the error


>Does anyone know if there is an updated odbccp32.dll or another way to configure ODBC setting from within VFP ?

If you cannot make it work in a reliable way, you could write the registry values directly (via API calls: RegOpenKey, etc; or using Rick Strahl's wwApi class). That's what SQLConfigDataSource does.

If you look at the registry you'll find the ODBC settings in
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI (user data sources)
HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI (system data sources)

Hope this helps,
------------------
Jose Marcenaro
Tercer Planeta - Argentina
http://www.tercerplaneta.com
Previous
Reply
Map
View

Click here to load this message in the networking platform