Dim ds Set objRS=objConn.Execute("SELECT * FROM [blog_Upload] WHERE ([ul_Quote] LIKE '%" CStr(ID) "%') ") ds=objRS.GetRows objRS.Close() Set objRS=Nothing
' 建立一个表格 Response.Write "Written By Sipo(www.dc9.cn)table align=""center"" border=""1"">" Response.Write vbcrlf Response.Write "tr>td>/td>" For j = 0 To UBound(ds, 1) Response.Write "td>ds("j",X)/td>" Next Response.Write "/tr>" ' 每一行 For i = 0 To UBound(ds, 2) Response.Write "tr>td>ds(X,"i")/td>" vbcrlf ' 每一列 For j = 0 To UBound(ds, 1) Response.Write "td>" If IsNull(ds(j, i)) Then Response.Write "Null" Else Response.Write ds(j, i) End If Response.Write "br>" Response.Write "b>ds("j","i")/b>" Response.Write "/td>" Next
GetRows 方法通常比一次读一笔记录的循环要来得快些,但使用这方法时,必须确定Recordset未包含太多记录;否则,会很容易以一个非常大的变量数组来填满所有内存。基于相同的原因,得小心不要包括任何BLOB(Binary Large Object)或CLOB(Character Large Object)字段;若如此做的化,应用程序一定会爆掉,特别是对于较大的Recordset而言。最后,记住此方法传回的变量数组是以0为基底的;传回记录的笔数是UBound(values,2)+1,传回字段数是UBound(value, 1)+1。