คุณสมบัติประเภทคำสั่ง ADO
❮ การอ้างอิงออบเจ็กต์คำสั่งที่สมบูรณ์
คุณสมบัติ CommandType ตั้งค่าหรือส่งกลับ ค่า CommandTypeEnum ที่กำหนดประเภทของอ็อบเจ็กต์ Command ค่าเริ่มต้นคือ adCmdUnknown
หากคุณไม่ระบุประเภท ADO จะต้องติดต่อผู้ให้บริการเพื่อกำหนดประเภทของคำสั่ง อย่างไรก็ตาม หากคุณระบุประเภท ADO จะสามารถประมวลผลคำสั่งได้เร็วขึ้น
ไวยากรณ์
objcommand.CommandType
ตัวอย่าง
<%
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")
comm.CommandText="orders"
comm.CommandType=adCmdTable
response.write(comm.CommandType)
conn.close
%>
CommandTypeEnum ค่า
Constant | Value | Description |
---|---|---|
adCmdUnspecified | -1 | Does not specify the command type argument. |
adCmdText | 1 | Evaluates CommandText as a textual definition of a command or stored procedure call. |
adCmdTable | 2 | Evaluates CommandText as a table name whose columns are all returned by an internally generated SQL query. |
adCmdStoredProc | 4 | Evaluates CommandText as a stored procedure name. |
adCmdUnknown | 8 | Default. Indicates that the type of command in the CommandText property is not known. |
adCmdFile | 256 | Evaluates CommandText as the file name of a persistently stored Recordset. Used with Recordset.Open or Requery only. |
adCmdTableDirect | 512 | Evaluates CommandText as a table name whose columns are all returned. Used with Recordset.Open or Requery only. To use the Seek method, the Recordset must be opened with adCmdTableDirect. This value cannot be combined with the ExecuteOptionEnum value adAsyncExecute. |
❮ การอ้างอิงออบเจ็กต์คำสั่งที่สมบูรณ์