Use "Storage Procedure" in Access (2)

zhaozj2021-02-08  453

(2) Use the stored procedure and then we can call these stored procedures in the ASP program. Here you can see why I said that the query in Access is its stored procedure - our CommandType property of our Command object is set 4, that is, Stored Proc! SO ... The following code is simple:

Code:

<%

Option expedition

DIM S

Randomize

s = rND * 100

DIM CONN, CMD

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

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

Conn.open "provider = microsoft.jet.Oledb.4.0; data source =" & server.mappath ("sp.mdb")

WITH CMD

.ActiveConnection = conn

.Commandtype = & h0004 'stored procedure

.Commandtext = "addnewdata"

End with

CMD.execute, Array (cstr (now ()), CSNG (S))

WITH CMD

.ActiveConnection = conn

.Commandtype = & h0004 'stored procedure

.Commandtext = "getData"

End with

Dim Resultrs, Resultay

Set resultrs = cmd.execute (, NULL)

IF not resultrs.eof then

ResulTarray = Resultrs.Getrows ()

END IF

SET Resultrs = Nothing

SET cmd = Nothing

Conn.close

Set conn = Nothing

Response.write "

    "

    DIM I

    For i = 0 to Ubound (ResulTarray, 2)

    Response.write "

  • " & resultArray (0, i)

    Response.write "" & ResulTarray (1, i)

    Response.write "" & ResulTarray (2, i)

    Response.write ""

    NEXT

    Response.write ""

    %>

    operation result.

    I feel, the speed seems very fast, huh, huh ~ I don't know if I use the stored procedure in Access, but it is really fun. ASP is not falling, but I still like its small fast spirit ~ Reference information:

    http://aspalliance.com/andrewmooney/default.aspx?article=16

    Http://support.microsoft.com/default.aspx?scid=kb;n-us;304352

    I am happy to communicate, my E-mail is: sinzy@mail.biti.edu.cn or ck@sinzy.net

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

New Post(0)