网络技术 > ASP程序
ASP的存储过程一个例子
分类:ASP程序    时间:2023-09-28    浏览:3357次

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

Copyright © 2014-2024 shaooo.com All Rights Reserved. 苏ICP备08014032号
返回顶部