There is a storage process:
Create Procedure Scturs
@acco varchar (20),
@USRID INT OUTPUT,
@usracco varchar Output,
@usrpwd varchar Output
AS
SELECT USR_ID, USR_ACCO, USR_PWD from user where usr_acco = @ acco
Return
Go
Code in the ASP file:
<%
SET cmd = server.createObject ("adodb.command")
cmd.activeConnection = Application ("dbstr")
cmd.comMandType = 4
cmd.comMandText = "SCTURS"
cmd.parameters.refresh
cmd.parameters ("@ acco") = "abc"
cmd.execute
CHK = cmd.parameters (0) 'How to get the value
SET cmd = Nothing
Response.write chk 'display result
%>
The result that needs to return should be:
USRID: 1
USRACCO: ABC
USRPWD: ABC1
If the conditions in the SELECT in the stored procedure are removed, the result will be the record set of many users. What measures will be used to display all records?
Reply to: zjcxc (Zou Jian) () Reputation: 349 2004-7-21 9:39:47 Score: 0 <%
SET cmd = server.createObject ("adodb.command")
cmd.activeConnection = Application ("dbstr")
cmd.comMandType = 4
cmd.comMandText = "SCTURS"
cmd.parameters.refresh
cmd.parameters ("@ acco") = "abc"
cmd.execute
USRID = cmd.parameters ("@ usrid") 'How to get the value
USracco = cmd.parameters ("@ usracco") 'How to get a value
Usrpwd = cmd.parameters ("@ usrpwd") 'How to get a value
SET cmd = Nothing
Response.write chk 'display result
%>
TOP
Reply to: zjcxc (Zou Jian) () Reputation: 349 2004-7-21 9:40:49 Score: 0 CHK = cmd.parameters (0) 'This is the value returned by RETURN statement during storage.
For the return value of the output parameter, the corresponding output parameters should be taken directly, namely:
USRID = cmd.parameters ("@ usrid")
TOP
Reply to: SWeiquan () Reputation: 100 2004-7-21 10:08:25 Score: 0 strange,
USRID = cmd.parameters ("@ usrid") is not valued, the data in the data table should be
I have not reported an error
TOP
Reply to: zjcxc (Zou Jian) () Reputation: 349 2004-7-21 10:43:56 Score: 0 - Nothing, your stored procedure has not written to create procedure Scturs
@acco varchar (20),
@USRID INT OUTPUT,
@usracco varchar Output,
@usrpwd varchar Output
AS
SELECT @ usrid = usr_id, @ usracco = usr_acco, @ usrpwd = usr_pwd
From [user]
Where usr_acco = @ acco
Go
TOP
Reply to: SWeiquan () Reputation: 100 2004-7-21 13:19:09 Score: 0 Thank you!
I haven't used it in ASP before, so I won't!
I have modified the stored procedure, I can get the value, but if there is a problem, only the first character is taken.
result:
USRID: 1
USRACCO: A
USRPWD: A
What is going on here? Trouble you again.
TOP
Reply to: zjcxc (Zou Jian) () Reputation: 349 2004-7-21 13:23:21 Score: 90 Create Procedure Scturs
@acco varchar (20),
@USRID INT OUTPUT,
@usracco varchar (50) Output, - The size here is the same below according to the definition of the corresponding fields in your table.
@usrpwd varchar (50) OUTPUT
AS
SELECT @ usrid = usr_id, @ usracco = usr_acco, @ usrpwd = usr_pwd
From [user]
Where usr_acco = @ acco
Go
TOP
Reply to: skyboy0720 (fly) () Reputation: 100 2004-7-21 13:26:46 Score: 10 During the ASP and stored procedures, the size of the parameter definition is best consistent!