Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLConfigDataSource-help with syntax
Message
From
06/07/1998 11:43:23
 
 
To
06/07/1998 11:37:58
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00114566
Message ID:
00114569
Views:
16
>I am looking to change a bunch of users from fox tables on a network to SQL databases in SQL Server. Is there a way to do this without going to every single machine and setting up the ODBC drivers? I think the windows API above will allow me to do this. Can I call this API within VFP 5.0 and use SQL Server without making changes on individual machines?
>I already have the fox code running on several machines that do have the ODBC control panel set up.

Ed,

Try this:

DECLARE INTEGER SQLConfigDataSource IN odbccp32.dll INTEGER, INTEGER, STRING, STRING

lcType = 'SQL Server'
lcODBC = 'DSN=' + ALLTRIM( tcDSN) + CHR(0) + ;
'Server=' + ALLTRIM( tcPath) + CHR(0) + ;
'Database=' + ALLTRIM( tcDatabase) + CHR(0) + ;
'Description=' + ALLTRIM( tcDSN)

with tcDSN being the name of the data source, tcPath the name of the server, tcDatabase the name of the database and tcDSN a description

You need to delete the data source first and then re-add - in case it changes for example and to ensure it is correct each time

*-- delete it
SQLConfigDataSource( 0, 3, lcType, lcODBC)
*-- Add it
SQLConfigDataSource( 0, 1, lcType, lcODBC)

If it returns 0, then an error happened.

HTH
regards

Ian
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform