1

我面临问题

“[DBNETLIB][ConnectionOpen(无效实例())。]无效连接。”

在使用 OLDDBConnection 时。下面的代码我正在使用

Dim objConn As OleDbConnection = New OleDbConnection("Provider=sqloledb;Data Source=IPADDRESS;Initial Catalog=EMS;User Id=****;Password=****;")
Dim objDS As DataSet = New DataSet()
Dim objCmdSelect As OleDbCommand = New OleDbCommand("select top 10 from EL_SERVER", objConn)
Dim objAdapter1 As OleDbDataAdapter = New OleDbDataAdapter()
objAdapter1.SelectCommand = objCmdSelect
objAdapter1.Fill(objDS)
4

1 回答 1

1
You will need to check if you are using correct Data Source name in your connection string. If you are using localhost then try to use IP address of server. If you have SQL server with the Instance then use instance name with the server Ip in your connection string. 


OR

 please remove the star symbol and type your user name and password on there..
    example:
    Dim objConn As OleDbConnection = New OleDbConnection("Provider=sqloledb;Data Source=IPADDRESS;Initial Catalog=EMS;User Id=abc;Password=abc;")
于 2012-10-24T04:05:13.193 回答