2-D array into a recordset

Results 1 to 2 of 2

Thread: 2-D array into a recordset

  1. #1
    Join Date
    Dec 1969

    Default 2-D array into a recordset

    Hello,<BR><BR>I have a small discrepancy with my code. I&#039;m trying to insert the contents of an array into table records on a database.<BR><BR>It does work, but it also inserts table records of all the blank elements of the array too (obviously, because the counter is lower bound to upper bound). For example:<BR><BR>--- Table ---<BR>00001 product_one $9.99 3<BR>00001 product_two $8.99 2<BR>blank blank blank blank<BR>blank blank blank blank<BR>...<BR><BR>Is there an efficient way to "redim preserve" the array (localCart(4,10) so that it only has elements that contain data, or can I use an "if then else" statement within the loop?<BR><BR>The loop is as follows:<BR><BR>&#060;%<BR>...<BR>for i = lbound(localCart,2) to ubound(localCart,2)<BR>rs.AddNew<BR>rs("ord_cust_i d") = idofaddedrecord<BR>rs("ord_id") = localCart(0,i)<BR>rs("ord_name") = localCart(1,i)<BR>rs("ord_price") = localCart(2,i)<BR>rs("ord_qty") = localCart(3,i)<BR>rs.Update<BR>next<BR>...<BR>%&#0 62;<BR><BR>If anyone has a good idea of how to fix this conundrum, I would truly appreciate it. Thank you...<BR>

  2. #2
    Reply Guest

    Default RE: 2-D array into a recordset

    If Not IsNull(localCart(0,i)) Then<BR>rs.AddNew etc<BR><BR>Or If Len(localCart(0,i) & "")&#060;&#062; 0 Then<BR>etc

Posting Permissions

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