본문 바로가기

기존카테고리/ASP

Getrows()_Function

  • ' This code makes only 3 calls to database, no matter how many rows!
  •  
  • strSQL = "SELECT ID, Name FROM users;"
  • Set objRS = Conn.Execute(strSQL) ' 1 call here
  • If Not objRS.EOF Then arrRS = objRS.GetRows() ' 2 calls here
  • Set objRS = Nothing
  • If IsArray(arrRS) Then
  •     For i = LBound(arrRS, 2) To UBound(arrRS, 2)
  •         ID = arrRS(0, i)
  •         Name = arrRS(1, i)
  •         Response.Write("<p>" & Name & " (" & ID & ")</p>" & vbCrLf)
  •     Next
  •     Erase arrRS
  • End If


  • 출처: http://aspdotnet.tistory.com/446 [심재운 블로그]



  • Function GetRSArray(strSQL)
  •     Set objRS = Conn.Execute(strSQL)
  •     If Not objRS.EOF Then arrRS = objRS.GetRows()
  •     Set objRS = Nothing
  •     GetRSArray = arrRS
  • End Function
  •  
  • ' Example usage
  • arrRS = GetRSArray("SELECT ID, Name FROM users;")
  •  
  • If IsArray(arrRS) Then
  •     For i = LBound(arrRS, 2) To UBound(arrRS, 2)
  •         ID = arrRS(0, i)
  •         Name = arrRS(1, i)
  •         Response.Write("<p>" & Name & " (" & ID & ")</p>" & vbCrLf)
  •     Next
  •     Erase arrRS
  • End If


  • 출처: http://aspdotnet.tistory.com/446 [심재운 블로그]

    '기존카테고리 > ASP' 카테고리의 다른 글

    총갯수 구하기  (0) 2016.11.18
    GetRows 함수  (0) 2016.07.07
    2차배열 Ubound 함수  (0) 2016.07.07
    Sub 과 Function 사용  (0) 2016.07.07
    배열선언 Dim과 ReDim  (0) 2016.07.07