|
ASP快速开发方法之数据操作(4) Thedata=Rs.GetRows(-1) Closedatabase Else Closedatabase End If End If SelectData=Thedata End Function End Class %>
嗯,复制它就可以了,现在我们的showit.asp可以简单地这样写:
showit.asp <!--#include file="conn.asp" --> <!--#include file="sql.asp" --> <% sql = "Select * from cnarticle" set loadData=new DataTable Thedata=loadData.SelectData(sql) If isarray(Thedata) then Num=ubound(Thedata,2) for i=0 to Num response.write("文章标题是:"& Thedata(1,i)) response.write("<br>文章作者是:"& Thedata(2,i)) response.write("<br>文章加入时间是:"& Thedata(3,i)) response.write("<br>文章内容是:"& Thedata(4,i)) response.write("<hr>") next else response.write("暂时还没有文章") End If %>
呵呵,这样,我们只要用两句语句就完成了数据的读取。同样的,通过在sql.asp中加入:
<% public Function SelectDataNum(sql) If sql<>"" then Opendatabase Rs.open sql,conn,1,1 If not Rs.eof then
|