Friday, November 21, 2008
Home
.Net
Database tricks
Export to anything
DBCodeCreator.Net
Easy BigIron to IISAM
Flatfile fixer
Tips for datalinks
Neat security trick
Real BLOB examples
Jet locked?
All ISAMS are relational

Data Link Tips

I find it interesting how many folks neave never heard of Datalink files or only know of tem as part of the VisualStudio wizards.

A data link is nothing more than a file-based connection; what's more making a data link is as easy as right-clicking on your desktop, choosing to create a new text file then changing the file's extension from .txt to .udl.  Voila, power!

I was not at first a fan of using UDLs.  But they do have their place (esp to replace FileBased ODBC connections with ADO provider connectivity).  However, the real thing I have always liked about the Data Link GUI is that it makes generating connection strings soooooo easy ... and they are pre-tested before I stick them in my apps.  

If you have not ever tried this technique, you should at least try it once.  Just create a data link then double click on it and run through the wizard to make and test your connection, then save it.  Now drop the file on NotePad ... and copy the Provider string right into your app.  It's a heck of a lot easier than the documented advice of putting an ADO Data control on a form and copying the settings then removing the control (dumb) or using the DE and manually copying the full text from the read-only Properties list.

If you don't want the UDL hanging around after you have made the connection string, just delete it ... or play with the feature of using the file as a dynamic connection system by putting the file in a shared location and passing the path to your Connection object as needed like:

Dim cn as ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = "File Name=" & App.path & "\MyUDL.UDL"
cn.open

(Note, you have to use the File Name technique carefully, it is "File Name=" & ... with each word Proper-Cased, a single space between and No space between the words and the Equal sign)

Another tip is similar to the SmithVoice Jet File Security page ... a Data Link does not have to have the UDL extension to be used by your app.  You only need it to call up the Data Link wizard GUI; After that you can rename the file to anything (Such as "boringthing.xxy" so that your users will not be tempted to look at it.  Your Connection objects don't care what the file name is, they only care that the contents are in the expected format.


Hope this Helps!

Robert Smith
Kirkland WA

added to smithvoice Oct 5 2000


Print  

pagecomment
  Add Comment



Submit Comment
  View Ratings
50.00%0
40.00%0
30.00%0
20.00%0
10.00%0

Number of Comments 0 , Average of Ratings
  View Comments
No comment.


Privacy Statement  |  Terms Of Use
Copyright 2008 by Robert C. Smith