Check carefully the link again.
Use SQLStringConnect() function
Example
connsql = "DRIVER=SQL Server;UID=sa;PWD=sa;DATABASE=excepciones;SERVER=METAFRAME"
sqlhandler = SQLSTRINGCONNECT(connsql)
IF sqlhandler < 1
MESSAGEBOX('No connection')
ENDIF
>mmm I set all the parameters... but it doesn't work.. I changed the values:
>
>
> strAttributes = "SERVER=METAFRAME" + Chr(0)
> strAttributes = strAttributes + "DESCRIPTION=Temp DSN " + Chr(0)
> strAttributes = strAttributes + "DSN=DSN_TEMP " + Chr(0)
> strAttributes = strAttributes + "DATABASE=excepciones " + Chr(0)
> strAttributes = strAttributes + "UID=" + Chr(0)
> strAttributes = strAttributes + "PWD=" + Chr(0)
> intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, strDriver, strAttributes)
>
>
>But IntRet returns 0 (zero)
>
>Any further help???
>
>>
>Is it possible to define / create and ODBC with VFP programming? I need to develope a new program with access to an existing SQL Server database and I would not like to go to each PC to create the ODBC by myself, instead of that, I would like to create an option on the program's menu for creating the needed connection to the SQL Database.>>
>>To make a programmatic connection to an ODBC driver, without using a DSN, you use the SQLStringConnect() function:
>>
http://fox.wikis.com/wc.dll?Wiki~VFPCommandSQLStringConnect
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst