Databases are widely used in applications to keep records. A large variaty of Database Management Systems are available in the market and in use. Every DBMS needs a different format of connection string. It's not possible to remember all those formats, so knowing how to get a Connection String for any database makes life easy.
UDL file Method
UDL Files are an easy way to get the desired connection string by simply filling in property pages. The following steps show how to make and use a UDL file for that.
1. Make a New Text Document
2. Open the Text Document, Click on Save As.
3. Write filename as something.udl, file type All files, click Save.
4. Now run something.udl
5. Click on Provider tab. Select the provider and click Next.
6. Give the DataBase Path.
7. Write Username, Password if any
7. Click on Test Connection.
8. If it's OK, then close it now.
9. Now open udl file as Text File with Notepad
11. The Last line will have the Connection String
Visual Studio DataSource Method
1. Add DatagridView to your Form.
2. Click on Arrow in Top Right Corner of DataGridView, Click Choose DataSource, Select Add New DataSource
3. Select Database, Click on Next.
4. Click on New Connection
5. Now Choose DataSource, Click on Continue
6. Browse For Database, Provide Username, Password, if any
7. Click On Test Connection
8. If all is Ok, Click Previous, Copy the Connection String, and Click Cancel, Delete DataGridView if you don't need it.
Oracle Connection String
Following is the Correct Format of Oracle Database Connection
private static string CONNECTION_STRING =
"User Id=myUserID;Password=myPassword;Data Source=(DESCRIPTION=" +
(For Detailed Study of Connection Strings)
Online Connection strings
SQL Connection Strings
Do suggest/Comment, Help Others