Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Data Source=192.168.1.28,1433
连接SQL server 2008 报错: [DBNETLIB][ConnectionOpen (Invalid Instance()).]
[DBNETLIB][ConnectionOpen (Invalid Instance()).]无效的连接。
以前写的是:
“Provider=SQLOLEDB.1;Persist Security Info=False;User ID=**;PWD=**;Initial Catalog=DatabaseName;Data Source=IP”
解决方法1:
改成
“Provider=SQLOLEDB.1;Persist Security Info=False;User ID=**;PWD=**;Initial Catalog=DatabaseName;Data Source=IP,1433″
就是把”Data Sourse = IP” 改为”Data Sourse = IP,端口”,就连接正常
解决方法2:
改成
“Provider=SQLOLEDB.1;Persist Security Info=False;User ID=**;PWD=**;Initial Catalog=DatabaseName;Data Source=IP,1433″
就是把”Data Sourse = IP” 改为”Data Sourse = 服务器别名(如localhost\sqlexpress,就是打开SQL Server Management Studio Express时在左侧上端那个名字)”,就连接正常