ADO กิจกรรมWillChangeRecordและ RecordChangeComplete
❮ การอ้างอิงออบเจ็กต์ชุดระเบียนที่สมบูรณ์
เหตุการณ์ WillChangeRecord
เหตุการณ์ WillChangeRecord ถูกทริกเกอร์ก่อนการเปลี่ยนแปลงระเบียนอย่างน้อยหนึ่งรายการ
หมายเหตุ:ก่อนที่เหตุการณ์นี้จะกลับมา ให้ตั้งค่าพารามิเตอร์สถานะเป็น adStatusCancel เพื่อยกเลิกการดำเนินการที่ทำให้เกิดเหตุการณ์นี้ หรือตั้งค่าเป็น adStatusUnwantedEvent เพื่อป้องกันการแจ้งเตือนที่ตามมา
เหตุการณ์ที่บันทึกการเปลี่ยนแปลงเสร็จสมบูรณ์
เหตุการณ์ RecordChangeComplete ถูกทริกเกอร์หลังจากมีการเปลี่ยนแปลงอย่างน้อยหนึ่งระเบียน
หมายเหตุ:ก่อนที่เมธอดนี้จะกลับมา ให้ตั้งค่าพารามิเตอร์สถานะเป็น adStatusUnwantedEvent เพื่อป้องกันการแจ้งเตือนที่ตามมา
หมายเหตุ:เหตุการณ์ WillChangeRecord หรือเหตุการณ์ RecordChangeComplete อาจเกิดขึ้นหากคุณเปลี่ยนเขตข้อมูลในระเบียนโดยใช้การดำเนินการชุดระเบียนอย่างใดอย่างหนึ่งต่อไปนี้: Update, Delete, CancelUpdate, AddNew, UpdateBatch และ CancelBatch
ไวยากรณ์
WillChangeRecord reason,numrec,status,objRs
RecordChangeComplete reason,numrec,objErr,status,objRs
Parameter | Description |
---|---|
reason | An EventReasonEnum value that specifies the reason for this event |
numrec | Indicates the number of records affected |
status | An EventStatusEnum value that indicates the status of the execution of the event |
objErr | The name of an Error object that describes the error if status is set to adStatusErrorsOccurred, otherwise it is not set |
objRs | The name of the Recordset Object that triggered this event |
เหตุการณ์ เหตุผล ค่า Enum
Constant | Value | Description |
---|---|---|
adRsnAddNew | 1 | An operation added a new record |
adRsnDelete | 2 | An operation deleted a record |
adRsnUpdate | 3 | An operation updated an existing record |
adRsnUndoUpdate | 4 | An operation reversed the update of a record |
adRsnUndoAddNew | 5 | An operation reversed the addition of a new record |
adRsnUndoDelete | 6 | An operation reversed the deletion of a record |
adRsnFirstChange | 11 | An operation made the first change to a record |
EventStatusค่า Enum
Constant | Value | Description |
---|---|---|
adStatusOK | 1 | The operation that caused the event was successful |
adStatusErrorsOccurred | 2 | The operation that caused the event failed |
adStatusCantDeny | 3 | The operation that caused the event cannot be cancelled |
adStatusCancel | 4 | The operation that caused the event is cancelled |
adStatusUnwantedEvent | 5 | Prevents subsequent notifications before the event method has finished executing |
❮ การอ้างอิงออบเจ็กต์ชุดระเบียนที่สมบูรณ์