快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

不要节约使用变量

Now, you might be wondering, what does he mean, Don\\\'t skimp on the variables? Well, often times it is more
efficient to use variables to store results from ADO queries or from objects, and then reference the
variable as opposed to continuously referencing the object.

For example, you could do this:


If Request.QueryString("Name") = "Frank" Then
...
End If

If Request.QueryString("Name") = "Steve" Then
...
End If

Response.Write("Your name is " & Request.QueryString("Name"))
Each time you use the Request object, ASP has to go read the QueryString variable name. You can reduce
this to having to just read this once by doing the following:


Dim strName
strName = Request.QueryString("Name")

If strName = "Frank" Then
...
End If

If strName = "Steve" Then
...
End If

Response.Write("Your name is " & strName)
Plus, I personally think the above scenario is easier to read. It\\\'s easier, I think, to mentally associate
strName to be the user\\\'s name as opposed to associating Request.QueryString("Name") as the user\\\'s name.
Just my two cents, though!
返回类别: 教程
上一教程: MICROSOFT 脚本编码器SCRIPT ENCODER介绍(2)全中文
下一教程: ASP 五大高效提速技巧

您可以阅读与"不要节约使用变量"相关的教程:
· ASP系列讲座(五)使用变量和常量
· ASP系列讲座(五)使用变量和常量
· ASP中使用SESSION变量的优缺点
· SQL语句中的一些参数如何用变量来代替
· 怎样使用ASP实现PING
    微笑服务 优质保证 索取样品