求ASP注释,谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/30 16:24:36
一、删除记录
opendataconn
xxlb=RtnReplaceInt(Trim(request("xxlb")),0)
id=changechr(request("id"))
ids=split(id,",")
for i=0 to ubound(ids)
tt=trim(ids(i))
conn.execute"delete from house where id="&tt&""
next
response.redirect "house.asp?xxlb="&xxlb&""
closedataconn

二、连接数据库
dim conn
dim char_str(20)
sub OpenDataConn()
dim connstr
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
connstr = connstr & Server.MapPath("../../data/fyhouse_free.mdb")
'response.write connstr
set conn=Server.CreateObject("AdoDb.Connection")
conn.Open connstr
end sub
详细一点可以吗?我是外行的,分数可以追加。谢谢你们了。

最好是每个语句都注释一下,函数也说一下。我自己也会去查查看的

一、删除记录
opendataconn '打开数据库连接
xxlb=RtnReplaceInt(Trim(request("xxlb")),0) '从里到外依次是接收xxlb变量,去除变量两端的空格,最外层是一个自定义函数,估计与替换有关。
id=changechr(request("id")) '接收id,并转换成字符串
ids=split(id,",") '把id按 "," 分割,并保存到数组ids中
for i=0 to ubound(ids) '用for循环遍历数组
tt=trim(ids(i)) '数组元素去除两端空格后赋值给tt
conn.execute"delete from house where id="&tt&"" '删除数据表中id=tt变量的记录
next '循环结束
response.redirect "house.asp?xxlb="&xxlb&"" '跳转到house页面并用get方法传递xxlb参数,值为xxlb变量的值.
closedataconn 关闭数据库连接
二、连接数据库
dim conn '定义变量
dim char_str(20) '定义数组
sub OpenDataConn() '自定义过程,用户链接数据库地
dim connstr 定义变量
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
connstr = connstr & Server.MapPath("../../data/fyhouse_free.mdb") '数据库驱动字符串
'response.write connstr 输出变量connstr的值
s