> > Hi All,
> > How to Create ODBC Connection Programmatically from VFP. Thanks in Adance.
> > Regards,
> > R.HARI HARAN
>
> If you are thinking about distribution then VFP InstallShield allows you to create ODBC Connections. Just check ODBC Resources and you can select which ODBC resources you want created from the ODBC items on your system.
>
> If you are talking about creating a VFP connection to an existing ODBC see the CREATE CONNECTION command.
>
> I'm sure there is also a way to create an ODBC connection via the Windows API, and someone here knows how...
>
> KTB
Hi,
Got this in my library that I gleemed off someone months ago on this site:
Delare the API, SQLConfigDataSource in my startup code:
* --- ODBC Code
DECLARE INTEGER SQLConfigDataSource IN odbccp32.DLL INTEGER,INTEGER, STRING, STRING
* --- Define a procedure that accepts a varaible directory in my case, or it can be the entire path and database.
* --- Procedure within application
PROCEDURE ODBC_UPIPE
PARAMETER DDIR
SETTINGS="DSN=UPIPE"+CHR(0)+;
"DESCRIPTION=ACCESS DRIVER"+CHR(0)+;
"DBQ=UPIPE.MDB"+CHR(0)+;
"DEFAULTDIR="+DDIR+CHR(0)
SQLCONFIGDATASOURCE(0,1,"Microsoft Access Driver (*.mdb)",SETTINGS)
endproc
Call the procedure and pass the parameters, in my case the directory that has my Upipe.mdb file.
odbc_upipe("C:\data")
Do not know if this works.... but give it a shot !
Pete from the Great White North. (Only in Canada, ay.) Over and Out ...