VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



UDL files

by Jos Keuter (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (7 Votes)

Use UDL files for your dataconnections instead of DSN.

Rate UDL files

Searching planet-source-code for 'UDL' resulted into nothing to my surprise. That's why I want to explain the basic use of it for your information and also hoping soon there will be some more articles or code-examples this subject.
1. Creating an UDL file.
Create a new textfile on your desktop and rename it as 'MyFirstUDL.udl'. Having done that you'll see that the icon has changed. Double-click it and voila! You can setup a dataconnection to any database and it works just like creating a DSN-connection.
2. Using an UDL file.
No you can reference this file from your code like this:
Set cnn = New ADODB.Connection
cnn.open "File Name=C:\...\Desktop\MyFirstUDL.udl"
3. What's the use?
You can add this file to your setup-project. So if your program has to change dynamically to another database you just have to call the UDL file, make the proper adjustments via the UDL-interface and reconnect to the database via the UDL.
I hope you find this as usefull as I did. I was searching for a peace of code wich builds UDL-files from the ground up. I anybody knows where to find code like this pleace mail me! Or else I have to build it myself... and I'm a lazy programmer! ;-)

Download this snippet    Add to My Saved Code

UDL files Comments

No comments have been posted about UDL files. Why not be the first to post a comment about UDL files.

Post your comment

Subject:
Message:
0/1000 characters