Array, Array, Array

Results 1 to 4 of 4

Thread: Array, Array, Array

  1. #1
    faizal Guest

    Default Array, Array, Array

    This is the error:<BR><BR>Index out of range <BR>/rob/homeloan1.asp, line 66 <BR>An array index is out of range. <BR><BR>and this is the code:<BR><BR> IDSQL = "select max(pid) from contact"<BR> set IDSQLrs = connection.execute (IDSQL)<BR> <BR> ID = IDSQLrs(0)<BR><BR>so what am I doing wrong?

  2. #2
    Join Date
    Dec 1969
    Posts
    848

    Default RE: Array, Array, Array

    try this<BR><BR>IDSQL = "select max(pid) as MaxPID from contact"<BR>set IDSQLrs = connection.execute (IDSQL)<BR><BR>ID = IDSQLRS("MaxPID")<BR> <BR>mj

  3. #3
    faizal Guest

    Default RE: Array, Array, Array

    If I use that I get this:<BR><BR>ADODB.Recordset error &#039;800a0cc1&#039; <BR><BR>Item cannot be found in the collection corresponding to the requested name or ordinal. <BR><BR>/rob/homeloan1.asp, line 62 <BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    402

    Default RE: Array, Array, Array

    the item returned from the execute method is a recordset object and *not* an array of values, and hence, values within it cannot be represented by ordinals. the recordset contains a set of records returned from a table query, for example. at any one time a recordset object will refer to single record within the set. to access values from this record you need to specify the field name. to access other records within the set, loop thru the recordset using the movenext method. at more efficient (esp with larger recordsets) of accessing the data within a recordset is to extract the data to an array using the getrows method. then, close the recordset and db connection, and loop thru the array, where you then reference the data using ordinals.<BR><BR>hope this helps, jb.


Posting Permissions

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