在asp编程中,如果你遵守了下面的变量命名规则,你的代码的可行性、可维护性将会更好:
一般命名规则
前缀 变量类型 例子
b or bln boolean bsuccess
c or cur currency camount
d or dbl double dblquantity
dt or dat date and time dtdate
f or flt float fratio
l or lng long lmilliseconds
i or int integer icounter
s or str string sname
a or arr array ausers()
o or obj com object opipeline
数据库对象的变量前缀:
前缀 对象类型 例子
cnn connection cnnpubs
rst recordset rstauthors
cmd command cmdemployee
fld field fldlastname
作用范围相关前缀:
前缀 描述
g_ 在global.asa中创建的变量
m_ 在include文件和asp文件中创建的变量
没有前缀 非静态变量,或者过程中的变量
