Connecting to a named instance of SQL Server 2008

2019-06-23 22:14发布

My ASP application connects to the network server where SQL Server 2000 is installed with no problem. The old code that works:

myConn.Open ("Driver={SQL Server};
              Server=myNetwrkServer;
              Database=myDB;
              UID=myID;PWD=myPWD;Trusted_Connection=NO;")

An instance of SQL server 2008 was installed on the same network server. The new code doesn't work:

myConn.Open ("Driver={SQL Server Native Client 10.0};
                      Server=myNetwrkServer\SQLServ2008;
                      Database=myDB;
                      UID=myID;PWD=myPWD;Trusted_Connection="NO";)

Please help!

7条回答
【Aperson】
2楼-- · 2019-06-23 23:20

It appears your Trusted_Connection parameter is terminating the connection string improperly.

Consider removing the Trusted_Connection altogether, or ensuring that you don't put the NO in quotes.

myConn.Open ("Driver={SQL Server Native Client 10.0};Server=myNetwrkServer\SQLServ2008;
                Database=myDB;UID=myID;PWD=myPWD;Trusted_Connection=NO;")
查看更多
登录 后发表回答