|
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
|
|
|
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")
%>
|
|
|
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
|
|
|
|
|
|
|
|