似乎在这里尝试了一切以使其正常工作,但是对于我可以在互联网领域找到的几乎每次迭代的无 dsn 连接字符串,我都会收到“不支持关键字”错误,下面显示了两个。
Public cnSystem As New SqlClient.SqlConnection
Public Sub ConnectToSQL()
Dim sConnectionString As String
Dim sServer As String
Try
'Always connect to production server to get startup environment variables
If gbIsProduction Then
If gsProductionServer = "" Then
sServer = "xxxxx-SQL"
Else : sServer = gsProductionServer
End If
Else : sServer = gsDevelopmentServer
End If
//Doesn't work
sConnectionString = "Network Library=DBMSSOCN;Data Source=xxxxx-SQL,1433;Inital Catalog=xxxxx;User ID=sa;Password=xxxxx;"
//Doesn't work
sConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;UserId=sa;Initial Catalog=xxxxx;Data Source=xxxxx-SQL;Password=xxxxx;"
cnSystem.ConnectionString = sConnectionString
cnSystem.Open()
cmdSystem.Connection = cnSystem
Catch ex As Exception
RaiseError("", "modGeneral." & System.Reflection.MethodBase.GetCurrentMethod().Name, Err.Number, Err.Description)
End Try
End Sub
关于使用我正在使用的数据对象与 SQL 服务器进行无 DSN 连接的正确连接字符串是什么的任何想法?
谢谢!