我一直在尝试修复已经使用100%与Oracle连接的项目。他们正在尝试升级项目以开始使用SQL Server 2012 Management Studio。但我在连接数据库时遇到问题。我们使用Windows身份验证。
我可以使用Management Studio和Windows身份验证直接登录到SQL Server 2012。如果我创建一个全新的WindowsApplication1
项目来测试连接代码,它可以正常工作,我使用此代码(并在conn.Open()
处获得错误):
Imports System.Data.SqlClient
Public Class Open_Filing_Image
'Create ADO.NET objects.
Private myConn As SqlConnection
Private myCmd As SqlCommand
Private myReader As SqlDataReader
Private results As String
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
'Create a Connection object.
Dim connStr As [String] = "Server=servername; Database=dbname; Integrated Security=True"
myConn = New SqlConnection(connStr)
'Create a Command object.
myCmd = myConn.CreateCommand
myCmd.CommandText = "SELECT DdocName FROM dbo.Document WHERE XAlaskaID = '72010' and DdocType = 'Filings'"
'Open the connection.
Try
myConn.Open()
MsgBox("Connection Open ! ")
Catch ex As Exception
MsgBox("Can not open connection ! ")
End Try
myReader = myCmd.ExecuteReader()
'Concatenate the query result into a string.
Do While myReader.Read()
results = myReader.GetValue(0)
Loop
'Display results.
Dim documentID As String = results
Dim outPath As String = "http://address.internet`enter code here`/" + documentID + (".pdf")
System.Diagnostics.Process.Start(outPath)
'Close the reader and the database connection.
myReader.Close()
myConn.Close()
End Sub
End Class
错误讯息:
已成功与服务器建立连接,但在登录过程中发生错误。 (提供者:SSL提供者,错误:0 - 无法解密指定的数据。
谢谢。
答案 0 :(得分:0)
修复它做其他程序员的一些研究和一些帮助:
该项目有一个阻止与SQL连接的Bcrypt引用。我删除了所有Bcrypt并在app.config中将传输凭据添加到Windows。无论如何,谢谢你们。