วัตถุการเชื่อมต่อ ADO
วัตถุเชื่อมต่อ
ออบเจ็กต์การเชื่อมต่อ ADO ใช้เพื่อสร้างการเชื่อมต่อแบบเปิดไปยังแหล่งข้อมูล ผ่านการเชื่อมต่อนี้ คุณสามารถเข้าถึงและจัดการฐานข้อมูลได้
หากคุณต้องการเข้าถึงฐานข้อมูลหลายครั้ง คุณควรสร้างการเชื่อมต่อโดยใช้วัตถุการเชื่อมต่อ คุณยังสามารถทำการเชื่อมต่อกับฐานข้อมูลโดยส่งสตริงการเชื่อมต่อผ่านออบเจกต์ Command หรือ Recordset อย่างไรก็ตาม การเชื่อมต่อประเภทนี้ดีสำหรับแบบสอบถามเดียวที่เฉพาะเจาะจงเท่านั้น
ProgID
set objConnection=Server.CreateObject("ADODB.connection")
คุณสมบัติ
Property |
Description |
Attributes |
Sets or returns the attributes of a Connection
object |
CommandTimeout |
Sets or returns the number of seconds to wait while
attempting to execute a command |
ConnectionString |
Sets or returns the details used to create a connection to a data
source |
ConnectionTimeout |
Sets or returns the number of seconds to wait for a connection to
open |
CursorLocation |
Sets or returns the location of the cursor service |
DefaultDatabase |
Sets or returns the default database name |
IsolationLevel |
Sets or returns the isolation level |
Mode |
Sets or returns the provider access permission |
Provider |
Sets or returns the provider name |
State |
Returns a value describing if the connection is open or
closed |
Version |
Returns the ADO version number |
วิธีการ
Method |
Description |
BeginTrans |
Begins a new transaction |
Cancel |
Cancels an execution |
Close |
Closes a connection |
CommitTrans |
Saves any changes and ends the current transaction |
Execute |
Executes a query, statement, procedure or provider specific
text |
Open |
Opens a connection |
OpenSchema |
Returns schema information from the provider about the data
source |
RollbackTrans |
Cancels any changes in the current transaction and ends the
transaction |
กิจกรรม
หมายเหตุ: คุณไม่สามารถจัดการเหตุการณ์โดยใช้ VBScript หรือ JScript (เฉพาะภาษา Visual Basic, Visual C++ และ Visual J++ เท่านั้นที่สามารถจัดการเหตุการณ์ได้)
ของสะสม
Collection |
Description |
Errors |
Contains all the Error objects of the Connection object |
Properties |
Contains all the Property objects of the Connection object |