Question : Reetrieving SQL data from a store procedure in  ASP

Hi,

I am working on a ASP application and finding very difficult to retrieve SQL data from a recordset =(. I was wondering if you could help me with this.

I have a connection declared in global.asa(ADOConnection) which I use for the rest of my queries and works great. My code is as follows:

I receive a string with the store procedures to execute  such as this:

Query = "EXEC spDataTranslateBegin INSERT INTO ##tempdata SELECT * FROM [dbo].[DataInf] WHERE ([DateTime] >= '19/07/2010 15:04:41') ORDER BY [ID] DESC EXEC spDataTranslateEnd"

Here the function that execute the query:

************************************************ function *****************************
Sub Export(Query)

dim Rs

 set Rs = server.createobject("ADODB.recordset")
 Set Rs = ADOConnection.Execute(Query)

 if not Rs.eof then
    while not Rs.eof
           ----------------do something with the fields ---------------
      Rs.movenext
    wend
  end if
  set Rs=nothing

End Sub
********************************************* end function **************************


When I want to read the recordset I get the following error:

Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
 
However I know the connection and recordset are fine because if I run the same code but with a simple query such as;

Query = "Select * from DataInf"  and it works fine.

It is just when I try to add an store procedure that the object becomes closed even if it is just one simple store procedure =(

I have tried with the command method, execute method and different properties such as adCmdStoredProc and even creating another connection and nothing seems to work =(.

Do you have any suggestion?

Thank you very much for reading my email.

Answer : Reetrieving SQL data from a store procedure in  ASP

Hi Donnie - That will probably work as long as you have the additional 4 pin power plug if it is required. In any case it won't hurt to try.
Random Solutions  
 
programming4us programming4us