Hey all I'm attempting to connect with my SQL Server which i log into using my home windows authentication user title and password. However, after i use that information within the code below it informs me that it may not connect...
Dim connetionString As String Dim cnn As SqlConnection connetionString = "Data Source=MSSQLPROD;Initial Catalog=MS435_PROD;User ID=me.here;Password=mypassword;" cnn = New SqlConnection(connetionString) Try cnn.Open() MsgBox("Connection Open ! ") cnn.Close() Catch ex As Exception MsgBox("Can not open connection ! ") End Try
You're using SQL Server authentication whenever you specify a person title and password within the connection string. Take away the user title and password and can include:
Data Source=MSSQLPROD;Initial Catalog=MS435_PROD;Integrated Security=SSPI
Which will make the link with make use of the Home windows authentication from the context performing the code.