Phương thức cập nhật hàng loạt ADO
❮ Hoàn thành tham chiếu đối tượng tập bản ghi
Phương thức UpdateBatch được sử dụng để lưu tất cả các thay đổi trong Recordset vào cơ sở dữ liệu. Phương pháp này được sử dụng khi bạn đang làm việc trên Tập bản ghi ở chế độ cập nhật hàng loạt.
Nếu thao tác lưu không thành công, lỗi thời gian chạy sẽ xảy ra và lỗi được lưu trữ trong bộ sưu tập Lỗi.
Mẹo: Phương thức CancelBatch hủy tất cả các cập nhật hàng loạt.
Lưu ý: Không phải tất cả các đối tượng Recordset đều hỗ trợ cập nhật hàng loạt.
Cú pháp
bool=objRecordset.UpdateBatch affectrecords
Parameter | Description |
---|---|
affectrecords | Optional. An AffectEnum value
that specifies which records this method will affect. Note: The value adAffectGroup will generate an error if there are no visible records in the Recordset |
Giá trị AffectEnum
Constant | Value | Description |
---|---|---|
adAffectCurrent | 1 | Affects only the current record |
adAffectGroup | 2 | Affects only records that satisfy the Filter setting (Filter must be set to a FilterGroupEnum value or an array of Bookmarks) |
adAffectAll | 3 | Affects all records if there is no Filter. Affects only visible records in the current chapter if Filter is set to a string criteria. Affect all rows of the Recordset if Filter is set to a FilterGroupEnum value or an array of Bookmarks |
adAffectAllChapters | 4 | Affects all records in all child Recordset, including those hidden by a currently applied filter |
❮ Hoàn thành tham chiếu đối tượng tập bản ghi