
Jul 04, 2014
Almost all applications that are developed these days will, at some point, connect to an external data source like SQL Server. When this need arises, you will have to establish a connection from your application to the SQL Server database. This connection contains the server’s name you are connecting to, credentials for authentication and also contains the name of the database that you want to connect to. These are only a few pieces of information that can be included in the connection. All of the information specified when setting up the connection will form part of a connection string. This connection string can be used by your application to access the database and not only retrieve information but also submit information to be saved. When we take a look at a basic connection string, for example:“Data Source=MYSQLSERVER; Initial Catalog=AdventureWorksDB; User ID =myuser; password = mypassword”In the connection string above, you will specify the server’s name by giving a value to the “Data Source” property, which in this case is MYSQLSERVER. You can specify the database name by providing a value to the “Initial Catalog” property. In my example, I will be using the AdventureWorksDB. The last part of the connection string is where you can specify your credentials, by providing a value for the “User ID” property and the “Password” property. Looking at this basic connection string, it can be hard to remember all properties that you want to use. Luckily there is an easier way to build this connection string! To do this, simply follow the steps below.
- Create a new text document anywhere you want and rename the extension to “.udl.”
- Open up the .udl file you have created, and you should see an interface to build the string. Press OK and then from this window, you’ll be able to select a provider, specify a server name, credentials, database name and even more options by going to the ‘Advanced’ and ‘All’ tabs.
- After you have specified your values, go ahead and open the .udl file in notepad. You’ll see something similar to the below image.
- Copy and paste this connection string to where you require it, and you are all good to go.
How do your Excel skills stack up?
Test NowNext up:
- 3 settings that will increase your efficiency in Microsoft Project
- The “New” Exchange 2013 Edge Transport Server
- Ace your next presentation with lessons from these tennis pros
- Sync document properties in SharePoint and Word
- Use SCCM 2012 R2 to manage Linux machines
- Easily convert dates to Australian format in Excel
- Cross-site publishing with SharePoint 2013
- Becoming a great workplace trainer starts with three words (Part 3)
- Remove blank rows in Excel with this VBA code
- 10 essential keyboard shortcuts in Photoshop
Previously
- Combine MATCH and INDEX in Excel for a powerful tool
- A truly botched presentation…but Samsung are happy!
- Monitoring communication sessions in Lync Server 2013
- How to populate tables in Excel VBA
- Protecting content in Microsoft Word with ‘Restrict Editing’
- Data Quality in SQL Server 2014 for dummies (Part 2)
- Customise the weather forecast in Outlook 2013
- Manage your administration with ADAC and PowerShell
- Automatically reach your deadlines with scheduled tasks in Microsoft Project
- Data Quality in SQL Server 2014 for dummies (Part 1)