Adjustment stored procedure

xiaoxiao2021-03-06  56

* /

CREATE Procedure Pr_TestAdd

@Studno varchar (10), - Student

@ID int, - article ID, corresponding to modification information, increasing null

@MagType varchar (50), - Journal Type

@Grade varchar (10), level (only core journal, there is level, other type null)

@ONEAUTHOR TINYINT, - Is there a unique author (1-- unique author, 0-- is not the only author)

@Authorseq varchar (50), - Author's order (only if the only author is not empty)

@Credit float output - Return Divide

)

The above is the definition of the stored procedure. Let's see why I am calling like this!

Set cmdsp = Server.createObject ("adodb.command")

Cmdsp.activeconnection = "driver = {SQL Server}; server = (local); uid = sa; pwd =; database = test"

CMDsp.Commandtext = "{Call Pr_TestAdd (?,?,?,?,?,?)}

Cmdsp.commandtype = adcmdspstoredProc

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ studno", Advarchar, Adparaminput, 10, "20140001")

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ ID", Adinteger, Adparaminput, NULL)

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ MagType", Advarchar, Adpaaminput, 50, "Core Journal")

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ grade", Advarchar, Adparaminput, 10, "A1")

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ OneAuThor", Adtinyint, Adparaminput, 0)

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ authorseq", advarchar, adpaaminput, 50, "first author")

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ Credit", Adparaminput)

'Run the stored procedure and get the return record set

Cmdsp.execute ()

IF err.number = 0 THEN

Response.write "OK"

Else

Response.write "failed"

END IF

Really very anxious! ! !

Reply to: lbilj () () Reputation: 100 2004-04-25 21: 54: 20Z Score: 0 The last output parameter is like this

Cmdsp.Parameters.Append Cmdsp.createParameter ("@ Credit", Adparamoutput) TOP

Reply to: lbilj () () Reputation: 100 2004-04-25 22: 19: 03Z Score: 0 Up

TOP

Reply to: lbilj () () Reputation: 100 2004-04-25 22: 57-04-25 22: 57: 29Z score: 0 No one has a research code on this issue,

TOP

Reply to: Jaron (Tang Bohu Point Mosquito Scenery) () Reputation: 317 2004-04-25 23: 03: 56Z Score: 30 I used to be used in the previous program, I hope to be useful to you.

SET cmd = server.createObject ("adodb.command")

cmd.activeConnection = db.conn

cmd.commandtext = "Enterprise_Registration_ADD"

cmd.commandtype = & h0004

cmd.parameters.Append Cmd.createParameter ("@ accout", 200, 1, 20)

cmd.parameters.Append Cmd.createParameter ("@ Password", 200, 1, 20)

cmd.parameters.Append Cmd.createParameter ("@ email", 200, 1, 50)

cmd.parameters.Append Cmd.createParameter ("@ regip", 200, 1, 20)

CMD ("@ accout") = Accord

CMD ("@ Password") = password

CMD ("@ email" = email

CMD ("@ regip") = regip

cmd.execute

'//user login

'@EnterpriseID Bigint Output,

'@Memeberid bigint Output,

'@ENPTERRPISELEVEL INT OUTOUTPUT,

'@Isisenterprise bit output

IF Err.Number <> 0 THEN

Str.Error ("

  • registration error, etc. will try again")

    Else

    Session ("EnterpriseID") = cmd ("@ EnterpriseID")

    SET cmd = Nothing

    END IF

    TOP

    Reply to: Jaron (Tang Bohu Point Mosquito) () Reputation: 317 2004-04-25 23: 05: 25Z Score: 20 If you just return to record set

    Can use:

    SET RS = conn.execute ("Stored Procedure Name Parameters 1, Parameters 2, Parameters 3")

    Do While Not (RS.eof)

    .........

    rs.movenext

    loop

    TOP

    Reply to: zhe5d (not shameful) () Reputation: 100 2004-04-26 01: 03: 34Z score: 20 1, call no parameters stored

    <%

    Set conn = server.createObject ("adoDb.connection")

    Set cmd = server.createObject ("adoDb.command") strconn = "DSN = PUBS; UID = SA; PWD"

    conn.open straconn

    Set cmd.activeconnection = conn

    cmd.commandtext = "{call nono}"

    'set = cmc.exe or cmd.execute

    set RS = cmd.execute ()

    %>

    2, a stored procedure for an input parameter

    <%

    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, adpaaminput)

    CMD ("@ aaa") = 100

    cmd.execute ()

    %>

    3, an input parameter and an output parameter

    <%

    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, adpaaminput)

    CMD ("@ aaa") = 10

    CMD.Parameters.Append Cmd.createParameter ("@ BBB", Adinteger, Adparamoutput)

    cmd.execute ()

    bbb = cmd ("@ bbb")

    %>

    4, an input parameter, an output parameter, and a return value

    <%

    Set conn = server.createObject ("adoDb.connection")

    SET cmd = server.createObject ("adodb.command")

    StrConn = "DSN = PUBS; UID = SA; PWD"

    conn.open strconnset cmd.activeconnection = conn

    cmd.commandtext = "{? = call onereturn (? )} "

    cmd.parameters.Append cmd.createParameter (" @ return_value ", adINteger, adparamreturnvalue)

    cmd.parameters.Append Cmd.createParameter ("@ aaa", adINteger, adpaaminput)

    CMD ("@ aaa") = 10

    CMD.Parameters.Append Cmd.createParameter ("@ BBB", Adinteger, Adparamoutput)

    cmd.execute ()

    bbb = cmd ("@ bbb")

    RRR = CMD ("@ return_value")

    %>

    TOP

    Reply to: INELM () Reputation: 133 2004-04-26 01: 15: 01Z score: 1 http://computer.blogger.cn/archimond/posts/2730.aspx

    TOP

    Reply to: lbilj () () Reputation: 100 2004-04-26 08: 49: 25Z score: 0 Do you talk about whether it will be related to the environment? Because the stored process I can call it before, I can't call it. I have a poison in my SQL Server. I reloaded SQL Server, but also installed .NET didn't know that these will do not affect, but I can run stored procedures in the SQL query analyzer.

    TOP

    Reply to: PCVC (Welcome to www.pcvc.net!) () Reputation: 93 2004-04-26 09: 55: 17Z score: 29 My example:

    Rs.open "EXEC PR_TESTADD @ Dsort = '" & Sort1 & ", @ forum_id =" & Request ("Forum_ID") & ", @ defdate ='" & defdate & "'with recompile", my_conn

    Direct operation record set RS is OK.

  • 转载请注明原文地址:https://www.9cbs.com/read-114191.html

    New Post(0)