codetoad.com
  ASP Shopping Cart, Forum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Stored procedure do not return recordset  hamiseixas at 14:39 on Wednesday, October 22, 2003
 

Hi,

I have a SQL Server Stored procedure and i am trying to get some values from it using ASP.

But when i execute this, i get error because my record set seems to return nothing.

Here is my ASP code, after set connections and recordset.

<%
sql = ""
sql = "EXEC SGA03S3031 NULL, NULL, NULL, NULL, NULL"

rsTeste.open sql, connTeste

if not rsTeste.eof then
rsTeste.MoveFirst
response.write(rsTeste("UO"))
else
response.write("Nada")
end if
%>

When I use Query Analyzer, i get a table with lots of field. But, when i use ASP, i get:
_________________________________________
ADODB.Recordset erro '800a0e78'

Operation is not allowed when the object is closed.

/projetos/Senac2003/publique/admin/web/templates/htm/senac_rio/busca/pop_busca_descricao.asp, line 25
________________________________________________

can somebody help me?
thanks a lot.

Hami.


<Added>

tett

  Re: Stored procedure do not return recordset  sunway at 03:56 on Thursday, October 23, 2003
 

You must use Command object in ASP.
1£¬µ÷ÓÃûÓ�²ÎÊýµÄ´æ´¢¹ý³Ì(Chinese characters)
<%
'no parameter stored procedure
set conn=server.CreateObject("adodb.connection")
set cmd=server.CreateObject("adodb.command")
strconn="dsn=pubs;uid=sa;pwd"

conn.Open strconn
set cmd.ActiveConnection=conn

cmd.CommandText="{call nono}"

'set rs=cmc.exe »òÕßcmd.execute

set rs=cmd.Execute()

%>
2£¬Ò»¸öÊäÈëµÄ²ÎÊýµÄ´æ´¢¹ý³Ì
<%
'one input parameter stored procedure
set conn=server.CreateObject("adodb.connection")
set cmd=server.CreateObject("adodb.command")
strconn="dsn=pubs;uid=sa;pwd"

conn.Open strconn
set cmd.ActiveConnection=conn

cmd.CommandText="{call oneinput(?)}"
cmd.Parameters.Append cmd.CreateParameter("@aaa",adInteger ,adParamInput )
cmd("@aaa")=100

cmd.Execute()

%>
3£¬Ò»¸öÊäÈë²ÎÊýº�Ò»¸öÊä³öµÄ²ÎÊý
<%
'one input and one output parameter stored procedure
set conn=server.CreateObject("adodb.connection")
set cmd=server.CreateObject("adodb.command")
strconn="dsn=pubs;uid=sa;pwd"

conn.Open strconn
set cmd.ActiveConnection=conn

cmd.CommandText = "{call oneinout(?,?)}"
cmd.Parameters.Append cmd.CreateParameter("@aaa",adInteger,adParamInput)
cmd("@aaa")=10
cmd.Parameters.Append cmd.CreateParameter("@bbb",adInteger,adParamOutput)

cmd.Execute()

bbb=cmd("@bbb")
%>
4£¬Ò»¸öÊäÈë²ÎÊý£¬Ò»¸öÊä³ö²ÎÊý£¬º�Ò»¸ö·µ»ØÖµ
<%
'one input¡¢one output parameter and a return value stored procedure
set conn=server.CreateObject("adodb.connection")
set cmd=server.CreateObject("adodb.command")
strconn="dsn=pubs;uid=sa;pwd"

conn.Open strconn
set cmd.ActiveConnection=conn

cmd.CommandText="{?=call onereturn(?,?)}"

cmd.Parameters.Append cmd.CreateParameter("@return_value",adInteger,adParamReturnValue )
cmd.Parameters.Append cmd.CreateParameter("@aaa",adInteger,adParamInput )
cmd("@aaa")=10
cmd.Parameters.Append cmd.CreateParameter("@bbb",adInteger,adParamOutput)

cmd.Execute()

bbb=cmd("@bbb")
rrr=cmd("@return_value")
%>

  Re: Stored procedure do not return recordset  dabora at 11:41 on Tuesday, March 15, 2011
 

Attitude is always pleasant to enjoy the fruits of our labours, of course. Sometimes, however, it seems that whatever we do, it's just not enough to be able to afford that new car or that foreign holiday. So, what do we usually do then? We work harder, longer; we increase the stress on our minds and bodies; we spend less time with our families and friends; we become more irascible and less likeable people. If you find yourself in this situation, just stop for a moment, and consider: Is it all worth it? What is the purpose of life? Surely it is to be happy. You'll probably be happier if you adopt the philosophy that true quality of life is not to be found in material things. If you convince yourself that you want less, you'll need less. If you need less, you'll cope with life more easily, and the happier, and therefore healthier, you'll be. Buddha called this "enlightenment". Enjoy a "good-health attitude". Focus on your abilities instead of disabilities. Be satisfied with what you have, rather than be dissatisfied about what you don't have and probably never will have.
_________________________________________________________________

642-436| PMI-001| 642-832| 642-642| 70-652| N10-004| 70-515| 70-432| 70-667| 350-018| 220-702| 70-646









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: ADDING A SUBMENU TO MENU SCRIPT
•  Re: Walk With Walter for UNICEF Sponsorship
•  Re: Position a script tag in a DIV probleme with IE
•  Re: repaint() slow performence..
•  Re: help for newbie -- VB macro in Excel
•  Re: How can use ASP.NET RegularExpressionValidator for alphanumeric 10 digit input
•  Re: only the year
•  sending of file over network
•  project on networking


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2011