ASP的存储过程一个例子
ASP程序  2023-09-28  3360次
  • ASP的存储过程一个例子

ASP存储过程
<%
dim conn,strcn,cmd
set conn=server.CreateObject("ADODB.Connection")
strcn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../dt.mdb")
conn.open strcn

set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
cmd.CommandType = 1
cmd.CommandText = "select  top 10 * from shaoabc order by id desc"
set rs = cmd.Execute

Do While Not rs.EOF
Response.write rs("it1")&"<br />"
rs.MoveNext
Loop

set cmd = nothing
%>
<hr />
<%
set cmd = Server.CreateObject("ADODB.Command")
with cmd
.ActiveConnection = conn
.CommandType = 1
.CommandText = "select  top 10 * from shaoabc order by id desc"
set rs = .Execute
end with

Do While Not rs.EOF
Response.write rs("it1")&"<br />"
rs.MoveNext
Loop

set cmd = nothing
%>
<hr />
<%
dim rsArray
Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
cmd.CommandType = 1
cmd.CommandText = "select  top 10 * from shaoabc order by id desc"
Set rs = cmd.Execute
rsArray = rs.GetRows()

For i = 0 To UBound(rsArray, 2)
Response.Write rsArray(1, i)&"<br />"
Next

set cmd = nothing
%>

WAP版 | 触屏版 | 电脑版

Copyright © 2014 shaooo.com