2

I'm trying to test a simple connection to my database with VB.NET on my SQL Server 2008. The problem is my login is with Windows Authentication mode and I enter no password for it to connect to my SQL server.

How will a connection string in this case look like? This has blocked my progress for the whole day.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim connetionString As String
        Dim connection As SqlConnection
        Dim i As Integer
        connetionString = "Data Source=PEDRAM-PC\PEDRAM;Initial Catalog=Test;User ID=Pedram-PC\Pedram;Password=bro"
        connection = New SqlConnection(connetionString)
        Try
            connection.Open()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
End Class

1 Answer 1

11

Add Integrated Security=SSPI instead of the username and password.

Sign up to request clarification or add additional context in comments.

1 Comment

ArgumentException:Keyword not supported: 'use integrated security'. I get it on connection = New SqlConnection(connetionString)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.