19
2020
03

GetRows

ASP源代码:

<html>

<body>


<%

set conn=Server.CreateObject("ADODB.Connection")

conn.Provider="Microsoft.Jet.OLEDB.4.0"

conn.Open(Server.Mappath("/db/northwind.mdb"))

set rs = Server.CreateObject("ADODB.recordset")

rs.Open "Select * from Customers", conn


'The first number indicates how many records to copy

'The second number indicates what recordnumber to start on

p=rs.GetRows(2,0)


response.write("<p>This example returns the value of the first column in the first two records:</p>")

response.write(p(0,0))

response.write("<br />")

response.write(p(0,1))


response.write("<p>This example returns the value of the first three columns in the first record:</p>")

response.write(p(0,0))

response.write("<br />")

response.write(p(1,0))

response.write("<br />")

response.write(p(2,0))


rs.close

conn.close

%>


</body>

</html>

运行结果:

Screenshot_20200319_150832.jpg

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。