Resordset Arrays and listbox, please help

Results 1 to 2 of 2

Thread: Resordset Arrays and listbox, please help

  1. #1
    Join Date
    Dec 1969

    Default Resordset Arrays and listbox, please help

    Hi I'm working on a listbox that pulls the Names, Addresses and Emails where school=certain school from a database, and list each persons email and name, EX: "Willis(", in a combo box using arrays. I have to do it using arrays because its a company decision. I have no idea on how to do this can anyone please help me with this issue?

  2. #2
    Join Date
    Dec 1969

    Default RE: Resordset Arrays and listbox, please help

    (This is from MSDN) :<BR><BR>Syntax<BR>array = recordset.GetRows( Rows, Start, Fields )Return Value<BR>Returns a Variant whose value is a two-dimensional array.<BR><BR>Parameters<BR>Rows <BR>Optional. A GetRowsOptionEnum value that indicates the number of records to retrieve. The default is adGetRowsRest. <BR>Start <BR>Optional. A String value or Variant that evaluates to the bookmark for the record from which the GetRows operation should begin. You can also use a BookmarkEnum value. <BR>Fields <BR>Optional. A Variant that represents a single field name or ordinal position, or an array of field names or ordinal position numbers. ADO returns only the data in these fields. <BR>Remarks<BR>Use the GetRows method to copy records from a Recordset into a two-dimensional array. The first subscript identifies the field and the second identifies the record number. The array variable is automatically dimensioned to the correct size when the GetRows method returns the data.<BR><BR>If you do not specify a value for the Rows argument, the GetRows method automatically retrieves all the records in the Recordset object. If you request more records than are available, GetRows returns only the number of available records.<BR><BR>If the Recordset object supports bookmarks, you can specify at which record the GetRows method should begin retrieving data by passing the value of that record&#039;s Bookmark property in the Start argument.<BR><BR>If you want to restrict the fields that the GetRows call returns, you can pass either a single field name/number or an array of field names/numbers in the Fields argument.<BR><BR>After you call GetRows, the next unread record becomes the current record, or the EOF property is set to True if there are no more records.<BR><BR>---------------------------------------<BR>1st dimension is the list of fields (the values)<BR>2nd dimension is list of records (# of results)<BR><BR>So you use it like this:<BR><BR>myArray = myRS.GetRows()<BR><BR>and you use it like this :<BR><BR>Ex.: Response.Write myArray(0, 5) &#039;to display the first field of the sixth record<BR><BR>You might want to use constants to simplify (and ease) your work<BR><BR>Ex.:<BR><BR>Const cSCHOOL_NAME<BR>Const cEMAIL<BR><BR>Dim i<BR><BR>myArray = myRS.GetRows()<BR><BR>&#039;Display all school name w/ their emails<BR><BR>For i = LBound(myArray, 2) to UBound(myArray, 2)<BR>Response.Write myArray(cSCHOOL_NAME, i) & " : " & myArray(cEMAIL, i) & "<BR>" & vbNewLine<BR>Next &#039;i<BR><BR>I hope this will help.<BR><BR>Stephane Dorion

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts