How to connect VB.net to SQL Server 2005 Express using Windows Authentication?

843 views Asked by At
 Public DbCon = "Data Source="";User ID="";Password="";Initial Catalog="";"

So far this is the code for SQL Server Authentication that I know.

I want to know the connection string for Windows Authentication

2

There are 2 answers

0
masterw On BEST ANSWER

Use the following code for an Sql Express connection on the local machine:

     Public DbCon = "Data Source=.\sqlexpress;Trusted_Connection=True;" 
0
LongArm On

Have a look at http://www.connectionstrings.com/sql-server/

The 2005 specific connection string is:

Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

Unless you have specified an instance name during SQL Express setup, in which case use:

Server=myServerName\myInstanceName;Database=myDataBase;User Id=myUsername;Password=myPassword;