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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection Strings

Database

Connection Strings

by  ca8msm  Posted    (Edited  )
This is not directly related to .NET but there have been so many users with errors in their connection string that this may be of some use.

Method 1
If you paste the following into a text file but save it with a vbs extension you can connect to any database and it will give you the connection string you need:

Code:
Dim objDataLinks, strRetVal
Set objDataLinks = CreateObject("DataLinks")
On Error Resume Next ' ignore cancel
strRetVal = objDataLinks.PromptNew
On Error Goto 0
If Not IsEmpty(strRetVal) Then
InputBox "Your Connection String is listed below.", _
         "OLE DB Connection String", strRetVal
End If
Set objDataLinks = Nothing

Method 2
Thanks to henslecd for the following alternative:

Another thing that you can do is right click on your desktop and choose to create a new text file. Rename the file's extension to .udl, such as conn.udl . Open the conn.udl file, choose the correct provider from the provider tab. Depending on the provider chosen, you will be given different set of choices in the connection tab. Enter in the info that corresponds to the DB you are connecting to. Test the connection. If it works, close conn.udl. Right click on the udl file, and choose to open it with NotePad. You will then see the proper connection string to use.

Method 3
http://www.codeproject.com/cs/database/DataLinks.asp

Method 4
http://www.connectionstrings.com
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top