I have migrated from one sever to another. I have restored my database and reset up my website. S开发者_如何学Pythonince migrating however my website will not connect to the database I am getting the following error:
Microsoft OLE DB Provider for SQL Server error '80004005'
[DBNETLIB][ConnectionOpen (Invalid Instance()).]Invalid connection.
My connection string is in the form of
CON_STRING = "Provider=SQLOLEDB;Data Source=myserver;Initial Catalog=mydb;User Id=user;Password=password"
The error is being thrown on the second line of the code below
Set rsBCT = Server.CreateObject("ADODB.Recordset")
rsBCT.ActiveConnection = CON_STRING
Would there be anything settings wise on the server that would need changing for this work? How can I try and debug what is going wrong. All my other applications which use web.config files are connecting fine. What troubleshooting steps can I take?
Use the instance name of the server in the connection string:
CON_STRING = "Provider=SQLOLEDB;Data Source=myServer\myInstance;Initial Catalog=mydb;User Id=user;Password=password"
----------------------------------------------------^^^^^^^^^^^
You may try to connect SQL instance higher than your OLEDB client version.
Therefore you can try to change your provider to "SQLNCLI" (Native SQL Client)
CON_STRING = "Provider=SQLNCLI;Data Source=myServer;Initial Catalog=mydb;User Id=user;Password=password"
精彩评论