⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 4.htm

📁 IIS5.0超级管理手册-网页开发篇 书籍语言: 简体中文 书籍类型: 网页设计 授权方式: 免费软件 书籍大小: 262 KB
💻 HTM
📖 第 1 页 / 共 5 页
字号:
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        AddNew</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        新增记录</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Customer.AddNew</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Update</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        编辑记录</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Customer.Update</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Remove</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        删除记录</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Customer.Remove</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Get</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        从资料库中传回一列记录</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Customer.GetNewest</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        List</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        传回多列记录</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Customer.ListNew</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td colSpan="3" style="line-height: 25px">
        <font size="2" style="line-height: 25px">
        如要指明有传回资讯之方法的传回值,请在方法或函式的名称中使用From和For。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        GetFor</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        传回符合条件的一列</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Customer.GerForName</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        ListFor</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        传回符合条件的多列</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Customer.ListForPeriod</font></td>
      </tr>
  </table>
  </center>
  <p><font face="arial" color="#3e78d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">物件的命名<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  在命名物件时,每个单字的开头都用大写字母,包括内建物件。您应该使用具描述性的名称来命名物件。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  下面是符合命名规则的范例:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">Set cnnSQL = Server.CreateObject(&quot; ADODB.Connection&quot;)
Set cnnSQLServer = Server.CreateObject(&quot; ADODB.Connection&quot;)</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  以下的名称不符合命名规则:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">Set cnnS = Server.CreateObject(&quot; ADODB.Connection&quot;)
Set cnnsql = Server.CreateObject(&quot; ADODB.Connection&quot;)</pre>
    </font>
  </div>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">使用MapPath路径<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  在ASP应用程式中应当考虑使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;MapPath&nbsp;</b></font>方法来代替精确的路径。ASP<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Server.MapPath&nbsp;</b></font>方法使您可以在更改了ASP应用程式的实体路径後无需更改指令档,这将减少修改和维护程式的工作。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  所以程式的效能会受到一些轻微的影响。因为每一次在指令档中使用MapPath时,IIS必须获取目前的伺服器路径。为避免取得伺服器路径,可以将该方法的呼叫结果放到应用程式变数中。</font></p>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">Select Case语法<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  为了让程式更加容易阅读和有效率,您可以使用Select Case语法代替If...Else重覆检视同一变数的不同值。例如:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">&lt;%
	Select Case intYrsService 
	      Case 0 to 5 
		    str Message = &quot;You have ten days paid leave this year.&quot; 
	      Case 6 to 15 
		    str Message = &quot;You have fifteen days paid leave this year.&quot; 
	      Case 16 to 30 
		    str Message = &quot;You have twenty days paid leave this year.&quot; 
	      Case 31 to 100 
		    str Message = &quot;Will you never leave?&quot; 
	End Select 
%&gt;</pre>
    </font>
  </div>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">指令档中的空格<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  为提高指令档的可读性,应该在运算符号(例如加号(+)、减号(-)、等号(=))的前後加上空格。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">例如:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">intYearsService = intYearCurrent - intYearFirst</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  当在传递或宣告多个变数时,在逗号的後面也应加上空格。</font></p>
  <hr style="line-height: 25px">
  <p>
  <font face="Arial" color="#3e77d7" size="3" Black style="line-height: 25px">
  <b style="line-height: 25px">说明</b></font> </p>
  <p><font face="arial" color="black" size="2" style="line-height: 25px">
  在ADO连线字串的参数中不能使用空格,因为这将导致错误。</font></p>
  <hr style="line-height: 25px">
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">语法的风格<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  每种指令档语言都有自己的风格,包括字母大小写、缩行方式以及其它和风格相关的特色。因为VBScript是不分辨大小写的,所以运用大小写可以提高程式的可读性,就像下列所显示的范例。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">&nbsp;If...Then...Else...End If&nbsp;</b></font>语法:</font></p>
  <font face="arial" color="#000000" size="2" style="line-height: 25px">
  <ul style="line-height: 25px">
    <li style="line-height: 25px">对If、Then、Else和End If的第一个字母大写。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">对If、Then,或 Else後的语法缩两个空格。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">在每个等号(=)前後面加上空格。<br style="line-height: 25px">
 </li>
    <li style="line-height: 25px">避免使用不必要的括号。<br style="line-height: 25px">
 </li>
  </ul>
  </font>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  正确的例子如:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">&lt;%
	If Request(&quot; FName&quot;)= &quot;&quot; Then 
	     Response.Clear 'Not required if Response is buffered. 
	     Response.Redirect &quot;test. HTML &quot; 
	Else 
	     Response.Write Request(&quot; FName&quot;)
	End If 
%&gt;</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  同样地,函式和副程序的第一个字母也要大写,它们的定义语法也必须内缩两个空格。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">例如:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">Sub SessionOnStart 
       Session(&quot; MyId&quot;)= Request.ServerVariables(...)
End Sub</pre>
    </font>
  </div>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">字串的连接<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  为了保持一致性和使用既有的解释方法,在VBScript中,字串连接符号是用「&amp;」而不用「+」。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  不要这样做:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">WholeName = FirstName + &quot; &quot; + LastName</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  而应这样做:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">WholeName = FirstName &amp; &quot; &quot; &amp; LastName</pre>
    </font>
  </div>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">字串函式<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  使用String(数目,字元)函式建立一个由重覆字元构成的字串。例如,要建立一个12个星号的字串:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">Dim strAstString 
str AstString = String(12,&quot;*&quot;)</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">虽然<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;String&nbsp;</b></font>()函式使用字元和字串作为参数,但是要比<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;For...&nbsp;</b></font>回圈看起来更简单。</font></p>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">变数大小写<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">透过<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Ucase()&nbsp;</b></font>或<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Lcase()&nbsp;</b></font>能使在指派变数和逻辑测试时保持大小写一致。这一点在指派核取方块与单选按钮等HTML的表单控制选项和逻辑测试时十分重要。</font></p>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">

⌨️ 快捷键说明

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