日期:2010-02-15 浏览次数:20991 次
实例演示:先建立一个简单的数据库,写个function读取一下,写入一个dim变量temp中:
ASP代码
以下为引用的内容: <% Function DisplayRecords() Dim sql, conn, rs sql = "SELECT id, [szd_f], [szd_t] FROM admin" Set conn = Server.CreateObject("ADODB.Connection") conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&Server.MapPath("db.mdb") Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sql, conn, 1, 3 If Not rs.EOF Then Dim temp temp = "<table width=""90%"" align=""center""" temp = temp & " border=""1"" bordercolor=""silver""" temp = temp & " cellspacing=""2"" cellpadding=""0"">" temp = temp & "<tr bgcolor=""#CCDDEE""><td width=""5%""" temp = temp & ">ID</td><td>操作</td>" temp = temp & "<td>数值</td></tr>" While Not rs.EOF temp = temp & "<tr><td bgcolor=""#CCDDEE"">" temp = temp & rs("ID") & "</td><td>" & rs("szd_f") temp = temp & "</td><td>" & rs("szd_t") temp = temp & "</td></tr>" rs.MoveNext Wend temp = temp & "</table>" DisplayRecords = temp Else DisplayRecords = "Data Not Available." End If rs.Close conn.Close Set rs = Nothing Set conn = Nothing End Function '写入缓存 Function DisplayCachedRecords(Secs) Dim
免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
|