คุณสมบัติตัวกรอง ADO
❮ การอ้างอิงออบเจ็กต์ชุดระเบียนที่สมบูรณ์
คุณสมบัติ ตัวกรอง ตั้งค่าหรือส่งคืนตัวแปรที่มีตัวกรองสำหรับข้อมูลในออบเจ็กต์ Recordset ตัวกรองช่วยให้คุณเลือกเรกคอร์ดที่ตรงกับเกณฑ์เฉพาะได้
คุณสมบัติตัวกรองสามารถมีสิ่งใดสิ่งหนึ่งต่อไปนี้:
- สตริงเกณฑ์
- อาร์เรย์ของบุ๊คมาร์ค
- ค่าFilterGroupEnum _
ตัวอย่างของสตริงเกณฑ์:
- rs.Filter="Lastname='Smith'"
- rs.Filter="Lastname='Smith' AND วันเกิด >= #4/10/70#"
- rs.Filter="Lastname='Jonson' OR Lastname='Johnson'"
- rs.Filter= "นามสกุล LIKE 'จอน*'"
- rs.Filter="[Company Name]='Alfred Futterkiste' OR Orders>$300.00"
ตัวอย่างอาร์เรย์ของบุ๊คมาร์ค:
สลัว fname(10)
fname(2)=rs.Bookmark
rs.Filter=fname(2)
เมื่อมีการตั้งค่าคุณสมบัติตัวกรอง เคอร์เซอร์จะย้ายไปยังระเบียนแรกในชุดระเบียนที่กรอง และเมื่อล้างคุณสมบัติตัวกรองแล้ว เคอร์เซอร์จะย้ายไปยังระเบียนแรกในชุดระเบียนที่ไม่มีการกรอง
ไวยากรณ์
objRecordset.Filter
FilterGroupEnum ค่า
Constant | Value | Description |
---|---|---|
adFilterNone | 0 | Removes the current filter |
adFilterPendingRecords | 1 | Filter that displays only edited records that have not yet been sent to the server |
adFilterAffectedRecords | 2 | Filter that displays only records affected by the last Delete, Resync, UpdateBatch, or CancelBatch call |
adFilterFetchedRecords | 3 | Filter that displays the records in the current cache |
adFilterConflictingRecords | 5 | Filter that displays those records that failed the last batch update |
❮ การอ้างอิงออบเจ็กต์ชุดระเบียนที่สมบูรณ์