当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO Connection对象

ADO
ADO DataTypes
ADO 摘要
ADO 实例

ADO Connection对象


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 948 ::
收藏到网摘: n/a

Connection 对象

The ADO Connection Object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database.
ADO Connection连接对象的作用是:创建一个到数据源的开放式连接。通过这个连接,你可以对数据库进行访问和操作。

If you want to access a database multiple times, you should establish a connection using the Connection object. You can also make a connection to a database by passing a connection string via a Command or Recordset object. However, this type of connection is only good for one specific, single query.
如果你想多次访问数据库,你可以使用Connection对象建立一个连接;你也可以通过一个指令[Command]或记录对象[Recordset]传递一个连接字符串从而来创建一个到数据库的连接。然而,这种连接类型仅适用于明确单一的查询语句

ProgID

set objConnection=Server.CreateObject("ADODB.connection")


Properties
属性

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]的访问权限
Provider Sets or returns the provider name
设置或返回技术提供对象[provider]的名称
State Returns a value describing if the connection is open or closed
返回一个用于描述连接是否打开或关闭的值
Version Returns the ADO version number
返回ADO版本号

Methods
方法

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
执行一个查询语句、陈述语句、程序或技术提供对象[provider]的详细文本
Open Opens a connection
打开一个连接
OpenSchema Returns schema information from the provider about the data source
返回技术提供对象[provider]关于数据源的schema信息
RollbackTrans Cancels any changes in the current transaction and ends the transaction
取消所有对当前处理的变更和程序的终止

Events
事件

Note:  You cannot handle events using VBScript or JScript (only Visual Basic, Visual C++, and Visual J++ languages can handle events).
注意:你不能通过使用VBScript或JScript来处理这些事件;你只能通过Visual Basic、Visual C++ 和Visual J++来处理这些事件。

Event时间 Description描述
BeginTransComplete Triggered after the BeginTrans operation
BeginTransComplete 在 BeginTrans 操作之后调用
CommitTransComplete Triggered after the CommitTrans operation
CommitTransComplete 在 CommitTrans 操作之后调用
ConnectComplete Triggered after a connection starts
ConnectComplete 在 connection 开始之后调用
Disconnect Triggered after a connection ends
Disconnect在 connection结束之后调用
ExecuteComplete Triggered after a command has finished executing
ExcuteComplete在一个指令结束执行之后调用
InfoMessage Triggered if a warning occurs during a ConnectionEvent operation
如果在执行ConnectionEvent程序时发生错误信息之后调用infoMessage
RollbackTransComplete Triggered after the RollbackTrans operation
RollbackTransComplete在RollbackTrans操作之后调用
WillConnect Triggered before a connection starts
WillConnect在一个连接开始之前调用
WillExecute Triggered before a command is executed
WillExecute在一个指令执行之前调用

Collections
集合

Collection集合 Description描述
Errors Contains all the Error objects of the Connection object
包含所有连接对象中的错误对象
Properties Contains all the Property objects of the Connection object
包含所有连接对象中的属性对象

评论 (0) All

登陆 | 还没注册?