Changing file DSN path at runtime

caneye
03-13-2004, 12:40 PM
I am creating an ActiveX control that will conect to a foxpro free table.
The activex will recieve a "data path" from it's parent app when activated.

I am currently connected to the free table via "file dsn". Is there any way that I can chage the data path of the file dsn at runtime?

my current code is as follows:
recordsetX.Open "Select * From freetable.dbf", "filedsn=mydsn;", adOpenDynamic, adLockOptimistic

I am able to access the table freetable but if the parent app moves the location of free table I need to be able to change the filedsn path accordingly.

Thanks in advance
Caneye

Peperl
04-20-2004, 10:03 AM
Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As Long, ByVal fRequest As Long, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long


with this api I have created and deleted system dsn dynamically, i suposse that the same function works to create, erease and modify what you are asking about

Search in www.AllApi.NET about SQLConfigDataSource

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum