World Of Webmaster
Đăng nhập / Đăng ký
Account
Free for web
Check pagerank
Input check pager (Not http://)

Ext: blog.kai.vn
Check google pagerank
View HTML source
FUNCTION LIBRARY
HTML Tags Library
PHP Functions Library ASP Functions Library
ASP Functions RecSet
Chức năng: Trả lại mảng hai chiều miêu tả kết quả câu lệnh SQL lên DB
Ngôn ngữ: asp - Nhóm: database
CÚ PHÁP
 array = RecSet(connstring, SQL) 

Trả lại mảng hai chiều miêu tả kết quả một câu lệnh SQL lên DB.
Các đối số:
connstring: đường dẫn đến DB tồn tại.
SQL: Câu truy vấn SQL.
Nếu không có bản ghi nào, hàm trả về giá trị null.

VÍ DỤ
<% 
  dim ar, i, j, cn, strSQL 
   
    cn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
        "Data  Source=" & server.mappath("/database/mydata.mdb") & ";" 
    strSQL    = "SELECT  exampleName, exampleDesc FROM examples ORDER BY exampleName;" 
      ar = RecSet(cn, strSQL) 
   
  If IsNull(ar) Then 
       '--- no results  found 
      response.write "<P  STYLE=""font-size:10pt;"">" & vbCrLf 
      response.write "No Results  Found!" & vbCrLf 
      response.write "</P>" & vbCrLf 
  Else 
      response.write "<P STYLE=""font-size:10pt;"">" & vbCrLf 
      For j = 0 to ubound(ar, 2) 
          For i = 0 to ubound(ar, 1) 
              response.write ar(i, j) & vbCrLf 
              response.write "<BR>" & vbCrLf 
          Next 
          response.write "<BR>" & vbCrLf 
      Next 
      response.write "</P>" & vbCrLf 
  End If 
%> 
ASP Code
<% 
  Private Function RecSet(byVal connstring, byVal SQL) 
      Dim DebugRs, Tmp 
      Set DebugRs = Server.CreateObject("ADODB.Recordset") 
      With DebugRs 
          .CursorType = 3 '--- adOpenStatic 
          .CursorLocation = 2 '--- adUseServer 
          .LockType = 1 '--- adLockReadOnly 
          .ActiveConnection = connstring 
          .Source = SQL 
          .Open 
          If .BOF then 
              Tmp = Null 
          Else 
              Tmp = .GetRows() 
          End If 
          .Close 
      End With 
      Set DebugRs = Nothing 
      RecSet = Tmp 
  End Function '--- RecSet 
%> 

CompactDB
DateDB
EscapeApos
EscapeBit
EscapeDate
EscapeInt
MkDatabase
NoSQLInjection
Procedures
RecordCount
Library ›› HTML Tag | PHP Function | ASP Function
Page : 806767
Online :
Visited : 370092
 
Liên h | Thêm vào Favorite | Gửi link qua e-mail | Thông tin website
Copright © 2009 KAI Blog
Code by BOINGOnline. Contact email : contact@kai.vn
Theme: default | classic |