ASP高手进来下啊

来源:百度知道 编辑:UC知道 时间:2024/05/03 06:31:04
<%
If IsObject(Conn) = false Then
set conn = Server.CreateObject("ADODB.Connection")
conn.Open conndata
If Err.Number <> 0 Then
Response.write "系统日常维护中!"
Response.End()
end if
end if

SMT_citytime="Now()"
SMT_citydate="date()"

%>

这个是什么意思呢。 .

<%
If IsObject(Conn) = false Then ;看是否是conn对象;
set conn = Server.CreateObject("ADODB.Connection");如果不是就创建conn对象;
conn.Open conndata ;conn对象打开数据库 conndata;
If Err.Number <> 0 Then ;如果错误号不为0,则返回"系统日常维护中!";
Response.write "系统日常维护中!"
Response.End() ;终止输出;
end if ;结束;
end if

SMT_citytime="Now()"
SMT_citydate="date()"

%>

首先声明我不是ASP高手。
这段代码大概的意思是:
先判断conn是否存在,如果不存在(第一句)
设置conn(第二句)
并打开conn所指定的某个字段conndata(第三句)
然后再判断出错代码是否不等于0,如果是(第四句)
输出信息:“系统日常维护中!”(第五句)
关闭输出(第六句)
结束判断
结束判断

把现在的时间赋值给 SMT_citytime
把今天的日期赋值给 SMT_citydate

是的,上面的回答都是对的。
可是,第二个答案更好些!