Convert connection string to SQLOLEDB

Connection code:

set conx = Server.CreateObject("ADODB.connection")
conx.Open Application("connectionString")

set cmdx = server.CreateObject("ADODB.command")
cmdx.ActiveConnection = conx
cmdx.CommandText = "dbo.sproc"
cmdx.CommandType = &H0004

set rsx = Server.CreateObject("ADODB.Recordset")
rsx.open cmdx

resarray = rsx.getrows 

      

This connection string works:

connectionString = "DRIVER=SQL Server;UID=User;Address=000.000.000.000;Network=DBMSSOCN;DATABASE=Database;SERVER=server;Password=password;"

      

Is not...

connectionString = "Provider=SQLOLEDB;Data Source=000.000.000.000;UID=User;Address=000.000.000.000;Network=DBMSSOCN;DATABASE=Database;SERVER=server;Password=password;"

      

The error I am getting:

ADODB.Recordset error '800a0e78'

Operation is not allowed when the object is closed. 

      

What am I missing?

+1


source to share


2 answers


Just a punt here, but the way OLEDB drivers handle row count information is different from ODBC.



I highly suspect that if you add SET NOCOUNT ON at the top of the stored procedure, the problem goes away.

+3


source


Sounds like a database permissions problem!



-1


source







All Articles