【问题标题】:Connection String with Windows Authentication Mode具有 Windows 身份验证模式的连接字符串
【发布时间】:2012-10-19 20:11:16
【问题描述】:

我正在尝试在我的 SQL Server 2008 上使用 VB.NET 测试与我的数据库的简单连接。问题是我的登录是使用 Windows 身份验证模式,我没有输入密码来连接我的 SQL 服务器。

在这种情况下,连接字符串会是什么样子?这阻碍了我一整天的进步。

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

【问题讨论】:

    标签: vb.net sql-server-2008


    【解决方案1】:

    添加Integrated Security=SSPI,而不是用户名和密码。

    【讨论】:

    • ArgumentException:不支持关键字:“使用集成安全性”。我在连接上得到它 = New SqlConnection(connetionString)
    猜你喜欢
    • 2017-03-23
    • 1970-01-01
    • 2012-02-08
    • 1970-01-01
    • 1970-01-01
    • 2012-12-25
    • 1970-01-01
    • 2019-08-08
    相关资源
    最近更新 更多