Record set, replaced by array/Rs. getrows ()/redim preserve, retain original data

Source: Internet
Author: User

  1. 'Excel connection driver
  2. Epath = "F:/web/test.xls"
  3. Estr = "provider = Microsoft. Jet. oledb.4.0; Data Source =" & epath "; extended properties = Excel 8.0"
  4. Set conn = server. Createobject ("ADODB. Connection ")
  5. Set rs = server. Createobject ("ADODB. recordset ")
  6. Set rst = server. Createobject ("ADODB. recordset ")
  7. Conn. Open estr
  8. Dim AAA, aaay, Yuhui
  9. AAA = CINT ("00" & request ("v_amount "))
  10. Rs. Open "select * from [test $]", Conn, 1, 1
  11. Yuhui = Rs. getrows (Rs. recordcount)
  12. Aaay = 0
  13. For fori = 0 to ubound (Yuhui, 2)-1
  14. If AAA> = CINT (Yuhui (1, forI) and AAA <CINT (Yuhui (1, forI + 1) Then aaay = Yuhui (2, forI) end if
  15. Next
  16. If AAA> = CINT (Yuhui (1, forI) Then aaay = Yuhui (2, forI) end if
  17. Rs. Close
  18. SQL = "update Member table set balance = balance +" & AAA "+" & aaay "where username = '" & remark1 "'"
  19. 'Response. Write SQL
  20. 'Conn.exe cute ("update Member table set balance = balance +" & AAA & "+" & aaay & "where username = '" & remark1 &"'")
  21. Conn. Close
  22. Set conn = nothing

 

 

Record set, which is replaced with an array to facilitate the use of table-like data. Because at the beginning, I forgot that the first column is a column and the second column is a row, so the code included for others ~~ For future use.

 

Redim preserve retains original data and redefines an array (one-dimensional array)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.