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 方法通常比一次讀一筆記錄的循環(huán)要來得快些,但使用這方法時,必須確定Recordset未包含太多記錄;否則,會很容易以一個非常大的變量數(shù)組來填滿所有內(nèi)存?;谙嗤脑?,得小心不要包括任何BLOB(Binary Large Object)或CLOB(Character Large Object)字段;若如此做的化,應(yīng)用程序一定會爆掉,特別是對于較大的Recordset而言。最后,記住此方法傳回的變量數(shù)組是以0為基底的;傳回記錄的筆數(shù)是UBound(values,2)+1,傳回字段數(shù)是UBound(value, 1)+1。