Filter and UpdateBatch mixed use to implement batch update

Source: Internet
Author: User
/******* part of the code *******/
/*******idarr () and Codearr () are two arrays, where Idarr () is the filter data filtering condition, Codearr () as the update data **********/
.......

Dim crs,sql,fstr
Sql= ""

Conn.begintrans
Set Crs=server. CreateObject ("Adodb.recordset")
Crs.activeconnection=conn
Crs.cursortype=1
Crs.locktype=3
Crs.source= "SELECT * from Mb_dcmanage"
Crs.open

For i=0 to UBound (Codearr)-1
Fstr= "dcm_id=" &idarr (i) ' defines data filtering
Crs.filter=fstr
CRs ("Dcm_code") =codearr (i)
Next
Crs.updatebatch (3) ' Batch update

........

/*********** avoids duplication of open operations, but filter itself is efficient, it should be combined with transaction processing, filter can be selected by multiple conditions, UpdateBatch parameters-----adaffectcurrent (1): Current position;
adAffectGroup (2): data that conforms to the filter
Adaffterall (3): All current Data ***************/



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.