Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Ken Blum
  Where is Ken Blum?
 Chicago
 Illinois - United States
 Ken Blum
 Tags
Subject: RE: Create ODBC Connection Programmatically
Thread ID: 22424 Message ID: 22429 # Views: 87 # Ratings: 0
Version: Visual FoxPro 7 Category: ODBC, ADO and OLEDB
Date: Thursday, April 17, 2003 5:47:16 PM         
   


> > 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 ...


COMPLETE THREAD

Create ODBC Connection Programmatically Posted by HARI HARAN RAMACHANDRAN @ 4/17/2003 4:22:08 PM
RE: Create ODBC Connection Programmatically Posted by Ken Blum @ 4/17/2003 4:46:07 PM
RE: Create ODBC Connection Programmatically Posted by Pete Sass @ 4/17/2003 5:47:16 PM
RE: Create ODBC Connection Programmatically Posted by vijayan @ 4/20/2003 8:34:23 AM