sql server开发技巧-12.htm

来自「微软数据库开发梦工场多媒体教学-sql server篇.rar,是多媒体教学的」· HTM 代码 · 共 55 行

HTM
55
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#000000" text="#FFFFFF">
<font color="#009900">Database Update - 用ASP编缉数据库记录 </font>
<p> </p>
<p>&lt;%' Defining some constants to make my life easier! (Same as Sample 1 &amp; 
  2)<br>
  ' Begin Constant Definition</p>
<p>' DB Configuration constants<br>
  ' Fake const so we can use the MapPath to make it relative.<br>
  ' After this, strictly used as if it were a Const.<br>
  Dim DB_CONNECTIONSTRING<br>
  DB_CONNECTIONSTRING = &quot;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=&quot; 
  &amp; Server.Mappath<br>
  (&quot;./db_scratch.mdb&quot;) &amp; &quot;;&quot;<br>
  ' We don't use these, but we could if we neeeded to.<br>
  'Const DB_USERNAME = &quot;username&quot;<br>
  'Const DB_PASSWORD = &quot;password&quot;</p>
<p>'Now we override the above settings to use our SQL server.<br>
  'Delete the following line to use the sample Access DB.<br>
  DB_CONNECTIONSTRING = Application(&quot;SQLConnString&quot;) &amp; &quot;UID=&quot; 
  &amp; Application(&quot;SQLUsername&quot;) <br>
  &amp; &quot;;PWD=&quot; &amp; Application(&quot;SQLPassword&quot;) &amp; &quot;;&quot;</p>
<p>' ADODB Constants<br>
  ' You can find these in the adovbs.inc file<br>
  ' Do a search for it and it should turn up somewhere on the server<br>
  ' If you can't find it you can download our copy from here:<br>
  ' http://www.asp101.com/samples/download/adovbs.inc<br>
  ' It may not be the most recent copy so use it at your own risk.<br>
  %&gt;<br>
  &lt;!-- #INCLUDE FILE=&quot;adovbs.inc&quot; --&gt;<br>
  &lt;%<br>
  ' End Constant Definition<br>
  %&gt;</p>
<p>&lt;%<br>
  Dim I ' Standard looping var<br>
  Dim iRecordToUpdate ' Id of deleted record</p>
<p>'We're going to keep this as simple as we can.<br>
  ' 1. Create a Recordset object<br>
  ' 2. Connect the Recordset to the table<br>
  ' 3. Find the record to update<br>
  ' 4. Update the record<br>
  ' 5. Update the table<br>
  ' 6. Close the Recordset</p>
<p>'Step 1:<br>
  Dim objRecordset<br>
  Set objRecordset = Server.CreateObject(&quot;ADODB.Recordset&quot;)</p>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?