Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Create a New ODBC DSN
Message
 
To
28/10/1999 10:41:47
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00283044
Message ID:
00283482
Views:
18
For your example, try:
settings="DSN=TestVFP"+chr(0)+;
         "Description=NEW_DSN_SQL7"+chr(0)+;
         "Server=Pro200"+chr(0)+;
         "Database=policia"+chr(0)+;
         "UID=Peter"+chr(0)

SQLConfigDataSource(0,1,"SQL Server",settings)
The third parameter is the driver name presented to users,
'SQL Server' in this case. The 'Database', is not the fisical file, but the name in SQL Server.

If you want to configure additional options that are available for SQL Server, you can manually create a data source with the required options. This configuration is stored in the windows registry:

HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC

If you open this key from 'regedit', you will see a list of all your ODBC entries. Look for the entry you are interested, and in the right pane you will see several pairs of 'string - value'. You can add this pairs to your setting string.

>I'm trying to discover how to create a NEW
>ODBC Data Sources Using SqlConfigDataSource
>
>*] First I use the Declare DLL function
>
>DECLARE Integer SQLConfigDataSource in odbccp32.dll Integer, Integer,;
>String, String
>
>*] Then I create a string containing the settings to the driver I'm using
>
>settings="DSN=TestVFP"+chr(0)+;
>"Description=NEW_DSN_SQL7"+chr(0)+;
>"Server=Pro200"+chr(0)+;
>"SourceDB=C:\mssql7\data\policia.MDF"+chr(0)+;
>"SourceType=MDF"+chr(0)+;
>"UID=Peter"
>
>y = SQLConfigDataSource(0,1,"TestVFP",settings)
>
>
>
>Problem: Which are the apropriate settings to create a NEW ODBC System DSN to connect from my Fox application to SQL Server 7.0.
>
>Could someone Help me please, with the correct
>seetings and the order of those settings.
>
>Thank's in Advance..
>
>Peter Wagner
>pointinfo@limeira.com.br
>Brazil - SP - Limeira
>
>* "DRIVER={SQL Server};Exclusive=No;SourceType=MDF;Deleted=No;
>* SourceDB=C:\mssql7\data\policia.MDF;Server=Pro200;UID=Peter;pwd=123"

Just an opinion... Not a fact.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform