Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Changing file DSN path at runtime


Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2004, 12:40 PM
caneye caneye is offline
Newcomer
 
Join Date: Aug 2003
Posts: 5
Default Changing file DSN path at runtime


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
Reply With Quote
  #2  
Old 04-20-2004, 10:03 AM
Peperl's Avatar
Peperl Peperl is offline
Senior Contributor
 
Join Date: Apr 2003
Location: Cartagena, Spain
Posts: 1,371
Default

Code:
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
__________________
Pri Oh Persia
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with changing file attributes... what's wrong with my code? Schroeder File I/O and Registry 3 07-31-2003 05:44 PM
File Problems: Files Not Closing etc. Templeton Peck General 5 03-29-2003 11:34 PM
File format problem kingesk General 1 09-08-2000 04:52 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->