Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedure to Recordset 1

Status
Not open for further replies.

sabloomer

Technical User
Aug 8, 2003
153
0
0
US
I have the existing code that works great...

'Create a connection to sql server
Set con = CreateObject("ADODB.Connection")
Set recordSet = CreateObject("ADODB.Recordset")

con.Provider = "SqlOleDB"
con.Properties("Data Source").Value = "MySERVER"
con.Properties("Initial Catalog").Value = "MyDatabase"
con.Properties("Integrated Security").Value = "SSPI"
con.Open

'Prepare command string to get number of columns
sql = "Select * from ReportTable"

'Open connection
recordSet.Open sql, con

I need to change the code to fill the recordset from a stored procedure. When I change the sql code def to ...

'Prepare command string to get number of columns
sql = "exec spReportTable @MyID= 25"

It looks like it runs but tells me the recordset is closed any time I try to use it. Does anyone have any suggestions?

Thank You,

sabloomer


 
Have a look at the Execute method of the ADODB.Connection object or at the ADODB.Commant object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry for the typo:
Have a look at the Execute method of the ADODB.Connection object or at the ADODB.Comman[!]d[/!] object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry for the delay in getting back to you.

Thanks to your suggestions I found...

Which was a big help. I also needed to change my provider on the connection string, but once I was using the SQL Server driver and Execute Method all things fell into place.

Thank You,

Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top