ADO Seek Method
❮ การอ้างอิงออบเจ็กต์ชุดระเบียนที่สมบูรณ์
เมธอด Seek จะค้นหาดัชนีของ Recordset เพื่อค้นหาเร็กคอร์ดที่ตรงกับค่าที่ระบุในพารามิเตอร์ keyvalues หากมีการแข่งขัน ตัวชี้จะชี้ไปที่เร็กคอร์ดที่ระบุโดยพารามิเตอร์การค้นหาตัวเลือก หากไม่มีการแข่งขัน ตัวชี้เรคคอร์ดจะถูกวางไว้ที่ส่วนท้ายของเรคคอร์ดเซ็ต
หมายเหตุ:เมื่อต้องการใช้วิธีนี้ ผู้ให้บริการต้องสนับสนุนวิธีนี้และการใช้ดัชนีบนชุดระเบียน (คุณสมบัติดัชนี) ใช้เมธอด Supports เพื่อกำหนดว่าผู้ให้บริการสนับสนุนการค้นหาและจัดทำดัชนีหรือไม่
หมายเหตุ:ตั้งค่าคุณสมบัติดัชนีเป็นดัชนีที่ต้องการก่อนดำเนินการวิธีนี้
หมายเหตุ:วิธีนี้สามารถใช้ได้กับเคอร์เซอร์ฝั่งเซิร์ฟเวอร์เท่านั้น (ไม่รองรับเมื่อค่าคุณสมบัติ CursorLocation คือ adUseClient)
หมายเหตุ:วิธีนี้สามารถใช้ได้เฉพาะเมื่อมีการเปิดอ็อบเจ็กต์ Recordset ด้วยค่า CommandTypeEnum ของ adCmdTableDirect
ไวยากรณ์
recordsetobj.Seek keyvalues,seekoption
Parameter | Description |
---|---|
keyvalues | Required. An array of values to compare with the values in each column |
seekoption | Required. A SeekEnum value that specifies the type of seek |
SeekEnum ค่า
Constant | Value | Description |
---|---|---|
adSeekFirstEQ | 1 | Seeks the first key equal to keyvalues |
adSeekLastEQ | 2 | Seeks the last key equal to keyvalues |
adSeekAfterEQ | 4 | Seeks either a key equal to keyvalues or just after where that match would have occurred |
adSeekAfter | 8 | Seeks a key just after where a match with keyvalues would have occurred |
adSeekBeforeEQ | 16 | Seeks either a key equal to keyvalues or just before where that match would have occurred |
adSeekBefore | 32 | Seeks a key just before where a match with keyvalues would have occurred |
❮ การอ้างอิงออบเจ็กต์ชุดระเบียนที่สมบูรณ์