📄 ado_ref_connection.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ADO Connection Object</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>ADO Connection Object</h1>
<a href="ado_ref_command.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="ado_ref_error.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<h2>Connection Object</h2>
<p>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.</p>
<p>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.</p>
<h3>ProgID</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<td valign="top">
<pre>set objConnection=Server.CreateObject("ADODB.connection")</pre>
</td>
</tr>
</table>
<br />
<hr />
<h3>Properties</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<th width="30%" align="left" valign="top">Property</th>
<th width="70%" align="left" valign="top">Description</th>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_conn_attributes.asp">Attributes</a></td>
<td valign="top">Sets or returns the attributes of a Connection
object</td>
</tr>
<tr>
<td valign="top"><a href="prop_conn_commandtimeout.asp">CommandTimeout</a></td>
<td valign="top">Sets or returns the number of seconds to wait while
attempting to execute a command</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_conn_connectionstring.asp">ConnectionString</a></td>
<td valign="top">Sets or returns the details used to create a connection to a data
source</td>
</tr>
<tr>
<td valign="top"><a href="prop_conn_connectiontimeout.asp">ConnectionTimeout</a></td>
<td valign="top">Sets or returns the number of seconds to wait for a connection to
open</td>
</tr>
<tr>
<td valign="top"><a href="prop_conn_cursorlocation.asp">CursorLocation</a></td>
<td valign="top">Sets or returns the location of the cursor service</td>
</tr>
<tr>
<td valign="top"><a href="prop_conn_defaultdb.asp">DefaultDatabase</a></td>
<td valign="top">Sets or returns the default database name</td>
</tr>
<tr>
<td valign="top"><a href="prop_conn_isolationlevel.asp">IsolationLevel</a></td>
<td valign="top">Sets or returns the isolation level</td>
</tr>
<tr>
<td valign="top"><a href="prop_conn_mode.asp">Mode</a></td>
<td valign="top">Sets or returns the provider access permission</td>
</tr>
<tr>
<td valign="top"><a href="prop_conn_provider.asp">Provider</a></td>
<td valign="top">Sets or returns the provider name</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_conn_state.asp">State</a></td>
<td valign="top">Returns a value describing if the connection is open or
closed</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_conn_version.asp">Version</a></td>
<td valign="top">Returns the ADO version number</td>
</tr>
</table>
<h3>Methods</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<th width="30%" align="left" valign="top">Method</th>
<th width="70%" align="left" valign="top">Description</th>
</tr>
<tr>
<td valign="top"><a href="met_conn_begintrans.asp">BeginTrans</a></td>
<td valign="top">Begins a new transaction</td>
</tr>
<tr>
<td valign="top"><a href="met_conn_cancel.asp">Cancel</a></td>
<td valign="top">Cancels an execution</td>
</tr>
<tr>
<td valign="top"><a href="met_conn_close.asp">Close</a></td>
<td valign="top">Closes a connection</td>
</tr>
<tr>
<td valign="top"><a href="met_conn_begintrans.asp">CommitTrans</a></td>
<td valign="top">Saves any changes and ends the current transaction</td>
</tr>
<tr>
<td valign="top"><a href="met_conn_execute.asp">Execute</a></td>
<td valign="top">Executes a query, statement, procedure or provider specific
text</td>
</tr>
<tr>
<td valign="top"><a href="met_conn_open.asp">Open</a></td>
<td valign="top">Opens a connection</td>
</tr>
<tr>
<td valign="top"><a href="met_conn_openschema.asp">OpenSchema</a></td>
<td valign="top">Returns schema information from the provider about the data
source</td>
</tr>
<tr>
<td valign="top"><a href="met_conn_begintrans.asp">RollbackTrans</a></td>
<td valign="top">Cancels any changes in the current transaction and ends the
transaction</td>
</tr>
</table>
<h3>Events</h3>
<p><b>Note:</b> You cannot handle events using VBScript or JScript (only Visual Basic, Visual C++, and Visual J++ languages can handle
events).</p>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<th width="30%" align="left" valign="top">Event</th>
<th width="70%" align="left" valign="top">Description</th>
</tr>
<tr valign="top">
<td valign="top"><a href="ev_conn_transcomplete.asp">BeginTransComplete</a></td>
<td valign="top">Triggered after the BeginTrans operation</td>
</tr>
<tr valign="top">
<td valign="top"><a href="ev_conn_transcomplete.asp">CommitTransComplete</a></td>
<td valign="top">Triggered after the CommitTrans operation</td>
</tr>
<tr>
<td valign="top"> <a href="ev_conn_connect.asp"> ConnectComplete</a></td>
<td valign="top">Triggered after a connection starts</td>
</tr>
<tr>
<td valign="top"> <a href="ev_conn_connect.asp"> Disconnect</a></td>
<td valign="top">Triggered after a connection ends</td>
</tr>
<tr>
<td valign="top"> <a href="ev_conn_execute.asp"> ExecuteComplete</a></td>
<td valign="top">Triggered after a command has finished executing</td>
</tr>
<tr>
<td valign="top"> <a href="ev_conn_infomessage.asp"> InfoMessage</a></td>
<td valign="top">Triggered if a warning occurs during a ConnectionEvent
operation</td>
</tr>
<tr>
<td valign="top"> <a href="ev_conn_transcomplete.asp"> RollbackTransComplete</a></td>
<td valign="top">Triggered after the RollbackTrans operation</td>
</tr>
<tr>
<td valign="top"><a href="ev_conn_connect.asp">WillConnect</a></td>
<td valign="top">Triggered before a connection starts</td>
</tr>
<tr valign="top">
<td valign="top"><a href="ev_conn_execute.asp">WillExecute</a></td>
<td valign="top">Triggered before a command is executed</td>
</tr>
</table>
<h3>Collections</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<th width="30%" align="left" valign="top">Collection</th>
<th width="70%" align="left" valign="top">Description</th>
</tr>
<tr>
<td valign="top">Errors</td>
<td valign="top">Contains all the Error objects of the Connection object</td>
</tr>
<tr>
<td valign="top">Properties</td>
<td valign="top">Contains all the Property objects of the Connection object</td>
</tr>
</table>
<br />
<hr />
<a href="ado_ref_command.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="ado_ref_error.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -