Reputation:
I have transferred a Classic asp site running on windows server 2003 to windows server 2008 but suddenly the below code has stopped working.
Const connStr_FC08 = "Provider=SQLNCLI10;Server=DS-47500;Database=TestDB;Uid=TestLogin;Pwd=test;Network=dbmssocn;"
Function connDB(OpenDB)
DIM conn
SET conn = Server.CreateObject("ADODB.Connection")
conn.open = connStr_FC08
If OpenDB = "Y" Then conn.open
connDB = conn
End Function
dim cn, cmd
cn = connDB("Y")
response.Write(cn.state)
This returns the below error
Microsoft VBScript runtime error '800a01a8'
Object required: 'Provider=SQLNCLI10.1'
This happens on the below line
response.write(cn.state)
Thanks Chris
Upvotes: 0
Views: 1066
Reputation: 2441
I see a few possible syntax issues with the code you posted:
...
conn.open = connStr_FC08
...
connDB = conn
...
cn = connDB("Y")
Should it be updated to the following?
...
conn.ConnectionString = connStr_FC08
...
Set connDB = conn
...
Set cn = connDB("Y")
Upvotes: 2
Reputation:
If I take opening of the connection out of the function and put in inline then there is no error and it works.
But my whole site works by using this function so a) I dont want to have to rewrite my code and b) I dont understand why this does not work when it used to.
Upvotes: 0
Reputation: 19479
You have that SQL Provider installed right?
You can put that function into a simple VBScript script to test without altering your pages any.
Upvotes: 0