ReDim 会把数组中的数据全部清空,加个参数
Redim Preserve arr(i)

解决方案 »

  1.   

        dim i as integer
            If rs.State = adStateOpen Then rs.Close
          Str = "select freight from orders where " & arr(i) & "=orderid "
          rs.Open Str, cn, adOpenDynamic, adLockReadOnly         ReDim arr(rs.recordcount-1)
           rs.movefirst
           i=0
           do while not rs.eof
              arr1(i) = rs.Fields(0)
    '          Print arr1(i)
              i=i+1
              rs.movenext
           loop
              Print ""
          For i = 0 To UBound(arr1)
              Print arr1(i)
          Next i
     
      

  2.   

    Redim Preserve
     Preserve应是关键字吧