บทช่วยสอน ASP

ASP HOME

กวดวิชา WP

แนะนำหน้าเว็บ มีดโกนหน้าเว็บ เค้าโครงหน้าเว็บ โฟลเดอร์หน้าเว็บ หน้าเว็บทั่วโลก แบบฟอร์มหน้าเว็บ วัตถุหน้าเว็บ ไฟล์หน้าเว็บ ฐานข้อมูลหน้าเว็บ ผู้ช่วยหน้าเว็บ หน้าเว็บ WebGrid แผนภูมิหน้าเว็บ อีเมลหน้าเว็บ ความปลอดภัยของหน้าเว็บ เผยแพร่หน้าเว็บ ตัวอย่างหน้าเว็บ ชั้นเรียนของหน้าเว็บ

มีดโกน ASP.NET

แนะนำมีดโกน มีดโกนไวยากรณ์ มีดโกน C# ตัวแปร มีดโกน C# ลูป มีดโกน C# Logic ตัวแปรมีดโกน VB มีดโกน VB Loops มีดโกน VB Logic

ASP Classic

แนะนำ ASP ไวยากรณ์ ASP ตัวแปร ASP ขั้นตอน ASP เงื่อนไข ASP ASP วนรอบ แบบฟอร์ม ASP คุกกี้ ASP เซสชัน ASP แอปพลิเคชัน ASP ASP #รวม ASP Global.asa ASP AJAX อีเมล ASP ตัวอย่าง ASP

การอ้างอิง ASP

ฟังก์ชัน ASP VB คีย์เวิร์ด ASP VB การตอบสนอง ASP คำขอ ASP แอปพลิเคชัน ASP เซสชัน ASP เซิร์ฟเวอร์ ASP ข้อผิดพลาด ASP ASP FileSystem ASP TextStream ไดรฟ์ ASP ไฟล์ ASP โฟลเดอร์ ASP พจนานุกรม ASP ASP AdRotator ASP BrowserCap การเชื่อมโยงเนื้อหา ASP ตัวหมุนเนื้อหา ASP ASP Quick Ref

กวดวิชา ADO

แนะนำ ADO ADO Connect ชุดระเบียน ADO จอแสดงผล ADO แบบสอบถาม ADO ADO Sort เพิ่ม ADO ADO Update ADO ลบ สาธิต ADO ADO เร่งความเร็ว

วัตถุ ADO

คำสั่ง ADO การเชื่อมต่อ ADO ข้อผิดพลาด ADO ADO Field พารามิเตอร์ ADO ADO พร็อพเพอร์ตี้ บันทึก ADO ชุดระเบียน ADO ADO สตรีม ประเภทข้อมูล ADO

ADO WillExecuteและ ExecuteComplete Events


❮ อ้างอิงวัตถุการเชื่อมต่อที่สมบูรณ์

เหตุการณ์คือรูทีนย่อยที่สามารถเรียกได้โดยอัตโนมัติหลังจากมีการดำเนินการเฉพาะเกิดขึ้น

  • เหตุการณ์WillExecuteสามารถเริ่มทำงานก่อนการเรียก objcomm.Execute, objconn.Execute หรือ objrs.Open
  • เหตุการณ์ExecuteCompleteสามารถเริ่มทำงานได้หลังจากการเรียก objcomm.Execute, objconn.Execute, objrs.Open, objrs.Requery หรือ objrs.NextRecordset เสร็จสมบูรณ์

ไวยากรณ์

WillExecute src,cursortyp,locktyp,options,
status,objcomm,objrs,objconn

ExecuteComplete recaffected,objerror,status,
objcomm,objrs,objconn

Parameter Description
src A string that contains an SQL command or a stored procedure name
cursortyp Specifies the type of cursor to be used. One of the CursorTypeEnum values
locktyp Specifies the type of lock to be used. One of the LockTypeEnum values
options One or more of the CommandTypeEnum or ExecuteOptionEnum values
recaffected The number of records affected by the execution
objerror An Error object that contains the errors that occurred

Note: The EventStatusEnum value must be set to adStatusErrorsOccurred to create the Error object

status An EventStatusEnum value
objcomm For WillExecute: Set to the Command object that was executed or to Nothing

For ExecuteComplete: The Command object that was executed

objrs For WillExecute: Set to the Recordset object that resulted from the execution of the command or to Nothing

For ExecuteComplete: The Recordset object that is the result of the executed command

objconn The Connection object that is associated with the execution of the command

CursorTypeEnum ค่า

ระบุชนิดของเคอร์เซอร์ที่ใช้ในอ็อบเจ็กต์ Recordset

Constant Value Description
adOpenUnspecified -1 Does not specify the type of cursor.
adOpenForwardOnly 0 Default. Uses a forward-only cursor. Identical to a static cursor, except that you can only scroll forward through records. This improves performance when you need to make only one pass through a Recordset.
adOpenKeyset 1 Uses a keyset cursor. Like a dynamic cursor, except that you can't see records that other users add, although records that other users delete are inaccessible from your Recordset. Data changes by other users are still visible.
adOpenDynamic 2 Uses a dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the Recordset are allowed, except for bookmarks, if the provider doesn't support them.
adOpenStatic 3 Uses a static cursor. A static copy of a set of records that you can use to find data or generate reports. Additions, changes, or deletions by other users are not visible.

LockTypeEnum ค่า

Constant Value Description
adLockUnspecified -1 Does not specify a type of lock. For clones, the clone is created with the same lock type as the original.
adLockReadOnly 1 Indicates read-only records. You cannot alter the data.
adLockPessimistic 2 Indicates pessimistic locking, record by record. The provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately after editing.
adLockOptimistic 3 Indicates optimistic locking, record by record. The provider uses optimistic locking, locking records only when you call the Update method.
adLockBatchOptimistic 4 Indicates optimistic batch updates. Required for batch update mode.

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 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.

ค่า ExecuteOptionEnum

Constant Value Description
adOptionUnspecified -1 Indicates that the command is unspecified.
adAsyncExecute 16 Indicates that the command should execute asynchronously. This value cannot be combined with the CommandTypeEnum value adCmdTableDirect.
adAsyncFetch 32 Indicates that the remaining rows after the initial quantity specified in the CacheSize property should be retrieved asynchronously.
adAsyncFetchNonBlocking 64 Indicates that the main thread never blocks while retrieving. If the requested row has not been retrieved, the current row automatically moves to the end of the file. If you open a Recordset from a Stream containing a persistently stored Recordset, adAsyncFetchNonBlocking will not have an effect; the operation will be synchronous and blocking. adAsynchFetchNonBlocking has no effect when the adCmdTableDirect option is used to open the Recordset.
adExecuteNoRecords 128 Indicates that the command text is a command or stored procedure that does not return rows (for example, a command that only inserts data). If any rows are retrieved, they are discarded and not returned. adExecuteNoRecords can only be passed as an optional parameter to the Command or Connection Execute method.
adExecuteStream 256 Indicates that the results of a command execution should be returned as a stream. adExecuteStream can only be passed as an optional parameter to the Command Execute method.
adExecuteRecord 512 Indicates that the CommandText is a command or stored procedure that returns a single row which should be returned as a Record object.

EventStatusค่า Enum

Constant Value Description
adStatusOK 1 The operation that fired the event was successful
adStatusErrorsOccurred 2 The operation that fired the event failed
adStatusCantDeny 3 Cannot cancel the pending operation
adStatusCancel 4 Cancels the operation that fired the event
adStatusUnwantedEvent 5 Prevents subsequent notifications before the event method has finished executing

❮ อ้างอิงวัตถุการเชื่อมต่อที่สมบูรณ์