Search Tools Links Login

UDL files

Use UDL files for your dataconnections instead of DSN.

Original Author: Jos Keuter


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 "File Name=C:...DesktopMyFirstUDL.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! ;-)

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 84 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.