📄 ev_conn_execute.asp
字号:
<!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 WillExecute and ExecuteComplete Events</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" />
<link rel="stylesheet" type="text/css" href="../stdtheme.css" />
<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>
<a name="top"></a>
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#808080">
<tr>
<td width="234" valign="top">
<a href="../default.htm"><img src="../images/w3default80.jpg" border="0" alt="W3Schools" /></a>
</td>
<th valign="middle" align="left" class="right">
<script type="text/javascript"><!--
google_ad_client = "pub-3440800076797949";
/*txtimg*/
google_ad_slot = "5330033957";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript" src="../../pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<noscript>
<a href="../default.asp" target="_blank"><img src="../banners/w6.gif" border="0" alt="W3Schools" /></a>
</noscript>
<br /></th>
</tr>
</table>
<table style="margin-left:1px" width="800px" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="137" class="content" valign="top"><br />
<a class="left" href="../default.asp" target="_top">
<img src="../images/homeicon.gif" border="0" alt="home" /></a>
<a class="left" href="../default.asp" target="_top">
<b>HOME</b></a>
<br /><br />
<b>ADO Tutorial</b><br />
<a class="left" target="_top" href="default.asp" >ADO HOME</a><br />
<a class="left" target="_top" href="ado_intro.asp" >ADO Intro</a><br />
<a class="left" target="_top" href="ado_connect.asp" >ADO Connect</a><br />
<a class="left" target="_top" href="ado_recordset.asp" >ADO Recordset</a><br />
<a class="left" target="_top" href="ado_display.asp" >ADO Display</a><br />
<a class="left" target="_top" href="ado_query.asp" >ADO Query</a><br />
<a class="left" target="_top" href="ado_sort.asp" >ADO Sort</a><br />
<a class="left" target="_top" href="ado_add.asp" >ADO Add</a><br />
<a class="left" target="_top" href="ado_update.asp" >ADO Update</a><br />
<a class="left" target="_top" href="ado_delete.asp" >ADO Delete</a><br />
<a class="left" target="_top" href="ado_demo.asp" >ADO Demo</a><br />
<a class="left" target="_top" href="ado_getstring.asp" >ADO Speed Up</a><br />
<br />
<b>ADO Objects</b><br />
<a class="left" target="_top" href="ado_ref_command.asp" >ADO Command</a><br />
<a class="left" target="_top" href="ado_ref_connection.asp" >ADO Connection</a><br />
<a class="left" target="_top" href="ado_ref_error.asp" >ADO Error</a><br />
<a class="left" target="_top" href="ado_ref_field.asp" >ADO Field</a><br />
<a class="left" target="_top" href="ado_ref_parameter.asp" >ADO Parameter</a><br />
<a class="left" target="_top" href="ado_ref_property.asp" >ADO Property</a><br />
<a class="left" target="_top" href="ado_ref_record.asp" >ADO Record</a><br />
<a class="left" target="_top" href="ado_ref_recordset.asp" >ADO Recordset</a><br />
<a class="left" target="_top" href="ado_ref_stream.asp" >ADO Stream</a><br />
<a class="left" target="_top" href="ado_datatypes.asp" >ADO DataTypes</a><br />
<br />
<a class="left" target="_top" href="ado_summary.asp" >ADO Summary</a><br />
<br />
<b>Examples</b><br />
<a class="left" target="_top" href="ado_examples.asp" >ADO Examples</a><br />
<br />
<b>Exam</b><br />
<a class="left" target="_top" href="../cert/default.asp" >ADO Exam</a><br />
<br />
<b>Selected Reading</b><br />
<a class="left" target="_top" href="../browsers/browsers_stats.asp">Web Statistics</a><br />
<a class="left" target="_top" href="../site/site_glossary.asp">Web Glossary</a><br />
<a class="left" target="_top" href="../hosting/default.asp">Web Hosting</a><br />
<a class="left" target="_top" href="../quality/default.asp">Web Quality</a><br /><br />
<a class="left" target="_top" href="../forum/default.asp">W3Schools Forum</a><br /><br />
<a class="left" target="_top" href="../about/about_helping.asp">Helping W3Schools</a><br /><br />
<script type="text/javascript"><!--
google_ad_client = "pub-3440800076797949";
/*LeftLinkUnit*/
google_ad_slot = "4854527104";
google_ad_width = 120;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="../../pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
<td valign="top">
<table style="border: 1px solid gray" width="100%" bgcolor="#FFFFFF" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>
<h1>ADO WillExecute and ExecuteComplete Events</h1>
<hr />
<a href="ado_ref_connection.asp"><img class="navup" src="../images/up.gif" alt="Connection Object Reference" border="0" /> Complete Connection Object Reference</a>
<hr />
<p>An event is a subroutine that can be called automatically after a specific
operation has occurred.
</p>
<ul>
<li>The <b>WillExecute</b> event can be fired just before a call to
objcomm.Execute, objconn.Execute, or objrs.Open.</li>
<li>The <b> ExecuteComplete</b> event can be fired after a call to objcomm.Execute,
objconn.Execute, objrs.Open, objrs.Requery, or objrs.NextRecordset is completed.</li>
</ul>
<h3>Syntax
</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr>
<td valign="top">
<pre>WillExecute src,cursortyp,locktyp,options,
status,objcomm,objrs,objconn</pre>
<pre>ExecuteComplete recaffected,objerror,status,
objcomm,objrs,objconn</pre>
</td>
</tr>
</table>
<br />
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr>
<th align="left" valign="top" width="20%">Parameter</th>
<th align="left" valign="top" width="80%">Description</th>
</tr>
<tr>
<td valign="top">src </td>
<td valign="top"> A string that contains an SQL command or a stored procedure name
</td>
</tr>
<tr>
<td valign="top">cursortyp </td>
<td valign="top"> Specifies the type of cursor to be used. One of the <a href="#cursortypeenum">CursorTypeEnum</a>
values
</td>
</tr>
<tr>
<td valign="top">locktyp </td>
<td valign="top"> Specifies the type of lock to be used. One of the <a href="#locktypeenum">LockTypeEnum</a>
values
</td>
</tr>
<tr>
<td valign="top">options </td>
<td valign="top"> One or more of the <a href="#commandtypeenum"> CommandTypeEnum</a> or
<a href="#executeoptionenum"> ExecuteOptionEnum</a> values
</td>
</tr>
<tr>
<td valign="top">recaffected </td>
<td valign="top"> The number of records affected by the execution
</td>
</tr>
<tr>
<td valign="top">objerror </td>
<td valign="top"> An Error object that contains the errors that occurred
<p><b>Note:</b> The EventStatusEnum value must be set to
adStatusErrorsOccurred to create the Error object
</td>
</tr>
<tr>
<td valign="top">status </td>
<td valign="top"> An <a href="#eventstatusenum">EventStatusEnum</a> value
</td>
</tr>
<tr>
<td valign="top">objcomm </td>
<td valign="top"> For <b>WillExecute</b>: Set to the Command object that was executed or to
Nothing
<p>For <b>ExecuteComplete</b>: The Command object that was executed</p>
</td>
</tr>
<tr>
<td valign="top">objrs </td>
<td valign="top"> For <b>WillExecute</b>: Set to the Recordset object that resulted from the execution of the command or to
Nothing
<p>For <b>ExecuteComplete</b>: The Recordset object that is the result of the executed
command</p>
</td>
</tr>
<tr>
<td valign="top">objconn </td>
<td valign="top"> The Connection object that is associated with the execution of the
command
</td>
</tr>
</table>
<br />
<hr />
<a name="cursortypeenum"><h3>CursorTypeEnum Values</h3></a>
<p>Specifies the type of cursor used in a Recordset object.</p>
<table cellpadding="3" width="100%" class="ex" cellspacing="0" border="1">
<tr valign="top" align="left">
<th width="30%">Constant</th>
<th width="10%">Value</th>
<th width="60%">Description</th>
</tr>
<tr valign="top">
<td>adOpenUnspecified</td>
<td>-1</td>
<td>Does not specify the type of cursor.</td>
</tr>
<tr valign="top">
<td>adOpenForwardOnly</td>
<td>0</td>
<td>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.</td>
</tr>
<tr valign="top">
<td>adOpenKeyset</td>
<td>1</td>
<td>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.</td>
</tr>
<tr valign="top">
<td>adOpenDynamic</td>
<td>2</td>
<td>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.</td>
</tr>
<tr valign="top">
<td>adOpenStatic</td>
<td>3</td>
<td>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.</td>
</tr>
</table>
<br />
<hr />
<a name="locktypeenum"><h3>LockTypeEnum Values</h3></a>
<table cellpadding="3" width="100%" class="ex" cellspacing="0" border="1">
<tr valign="top" align="left">
<th width="30%">Constant</th>
<th width="10%">Value</th>
<th width="60%">Description</th>
</tr>
<tr valign="top">
<td>adLockUnspecified</td>
<td>-1</td>
<td>Does not specify a type of lock. For clones, the clone is created with
the same lock type as the original.</td>
</tr>
<tr valign="top">
<td>adLockReadOnly</td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -