Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using UDL File in Data Environment

Status
Not open for further replies.

cdraycott

Programmer
Joined
May 24, 2001
Messages
57
Location
GB
Hi,

I have written an ActiveX control which connects to a SQL database but i need the ability to connect to different datbase names and servers.

I am currently using a UDL file for my ConnectionSource property for the DEConnection object.

I manually set the ConnectionSource proprty in the properties window as File Name=C:\Viewer.udl

The control is to be access via the internet and the control should download on startup if its not already registered and then copy the udl file to the correct path.

I have two questions:

1. How do i set the udl file to be situated in the current directory wherever the program runs from?
2. How do i get the control to copy across the udl file from the cab file in the network folder to the local machine in the correct place.


Can anyone help?

Thanks
 
My suggestion is to lose the udl file and go with a connection string -- much more versatile.
 
How can i control what will appear in the connection string without rebuilding the ocx file.

For example if the database name is different on another site where it is used, how will it get changed. The reason I was using the udl file is because the user only has to change the details on this and then it will change where the data environment looks.

 
You could design the control to accept a connection string as a parameter, wrather than hard-coding it. There is no difference in security between the two methods, as a UDL can be edited. In the numerous books that I have read on databases and components, the writer always opts against using a UDL in favor of a connection string. IMHO a UDL is an unnecessary dependancy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top