添加速度问题!急急!源码如下

lishubao 2008-04-23 02:12:55
为什么在添加页面上,写insert 语句速度那么慢?到跳转页速度就很快,请大家帮忙,谢过了^_^

<%
'判断是否有添加权限 rank 1:查看2:修改3:管理
if session("rank")=0 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权修改管理员!');history.go(-1);</script>"
response.End

else
dim usercode
dim username
dim strsoftype
dim PassWord
dim temp
dim sql,sql1
dim code
dim FileName
dim action
'判断同一经销商不能注册两个
Dim code1,filename1,sql2
filename1 = replace(trim(request("anclassid")),"'","")
action = replace(trim(request("action")),"'","")
response.Write action
if action="add" then
set rs=server.CreateObject("adodb.recordset")

rs.Open "select distinct code from users_files where name='"&filename1&"' ",conn,1,1
Code1=rs("code")
set rs=server.CreateObject("adodb.recordset")
sql2="select count(*) as gs from users_persions where filecode='"&Code1&"' "
rs.Open sql2,conn,1,1
if rs("gs")>0 then
response.Write "<script LANGUAGE='javascript'>alert('用户编码不能重复,请重新填写!');history.go(-1);</script>"
else
usercode = replace(trim(request("code1")),"'","")
username = replace(trim(request("name1")),"'","")
FileName = replace(trim(request("anclassid")),"'","")
PassWord = replace(trim(request("PassWord1")),"'","")
'查询经销商编码
set rs=server.CreateObject("adodb.recordset")
sql1="select distinct code from users_files where name='"&FileName&"' "
rs.open sql1,conn,1,1
code=rs("code")
'判断添加的用户是否存在
set rs=server.CreateObject("adodb.recordset")
sql="select count(*) as gs from users_persions where code='"&strclasscode&"'"
rs.open sql,conn,1,1
if rs("gs")>0 then
response.Write "<script LANGUAGE='javascript'>alert('用户编码不能重复,请重新填写!');history.go(-1);</script>"
else
sql="insert into users_persions(Code,name,FileCode,Filename,PassWord,RegisterTime) values('"&usercode&"','"&username&"','"&code&"','"&FileName&"','"&PassWord&"','"&time&"')"
conn.execute(sql)
' response.Write sql
response.Write "<script LANGUAGE='javascript'>alert('添加成功!');history.go(-1);</script>"
set rs=nothing
conn.close
set conn=nothing
' response.Redirect "login.asp"
end if
end if
end if
end if
%>
...全文
15 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
jhwcd 2008-04-30
用存贮过程来做,那就会快很多
回复
lishubao 2008-04-23
自己顶!!!!!!
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-04-23 02:12
社区公告
暂无公告