ADO ทรัพย์สินของรัฐ
❮ การอ้างอิงออบเจกต์สตรีมที่สมบูรณ์
คุณสมบัติ State ส่งกลับค่าที่อธิบายว่าอ็อบเจ็กต์เปิดอยู่ ปิดอยู่ เชื่อมต่อ ดำเนินการหรือดึงข้อมูลหรือไม่ ค่าส่งคืนค่าObjectStateEnum ค่าเริ่มต้นคือ adStateClosed
คุณสมบัตินี้สามารถใช้ได้กับอ็อบเจ็กต์ Command , Connection , Record , RecordsetและStream
คุณสมบัติ State สามารถมีค่าผสมกันได้ หากมีการเรียกใช้คำสั่ง คุณสมบัตินี้จะมีค่ารวมของ adStateOpen และ adStateExecuting
ไวยากรณ์
object.State
ตัวอย่าง - สำหรับวัตถุคำสั่ง:
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set comm=Server.CreateObject("ADODB.Command")
response.write(comm.State)
conn.close
%>
ตัวอย่าง - สำหรับวัตถุการเชื่อมต่อ:
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
response.write(conn.State)
conn.close
%>
ObjectStateEnum ค่า
ระบุว่าอ็อบเจ็กต์เปิดหรือปิด เชื่อมต่อกับแหล่งข้อมูล ดำเนินการคำสั่ง หรือการดึงข้อมูล
Constant | Value | Description |
---|---|---|
adStateClosed | 0 | The object is closed |
adStateOpen | 1 | The object is open |
adStateConnecting | 2 | The object is connecting |
adStateExecuting | 4 | The object is executing a command |
adStateFetching | 8 | The rows of the object are being retrieved |
❮ การอ้างอิงออบเจกต์สตรีมที่สมบูรณ์