insert操作没有完成的奇怪问题

CodeBeginner CodeBeginner 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
Function CheckInput(str)
Dim strTemp,strSemicolon,strNote
strSemicolon = "$$$"
strNote = "$$$$"
strTemp = Replace(str,";",strSemicolon)
strTemp = Replace(str,"--",strNote)

If InStr(LCase(str),"chr(59)") > 0 Or InStr(LCase(str),"chr(45)chr(45)") > 0 Then
Response.End
End If

If InStr(LCase(str),"char(59)") > 0 Or InStr(LCase(str),"char(45)char(45)") > 0 Then
Response.End
End If
CheckInput = strTemp
End Function


strAim = CheckInput(Request.Form("aim"))
strYam = CheckInput(Request.Form("yam"))
......

strSql="Update dat04_cart Set isorder=1, ordercode='" & strOrderCode & "' Where uid='" & strUID &"'"
Conn.Execute(strSql)

strSql="insert into dat05_order (total,firstname,lastname,email,priphone,secphone,icq,msn,aim,yam,ordercode) values(" & fltTotal & ",'" & strFname & "','" & strLname & "','" & strEmail & "','" & strPriPhone & "','" & strSecPhone & "','" & strIcq & "','" & strMsn & "','" & strAim & "','" & strYam & "','" & strOrderCode & "')"
Conn.Execute(strSql)

response.redirect "payment.asp?ordercode="& strOrderCode & "&total=" & fltTotal

我想在dat05_order和dat04_cart中应该同时存在相同strordercode(如od526)的记录,但昨天发现有以od526的记录在dat04_cart中,但在dat05_order中却没有od526的记录,我奇怪的是若代码执行insert语句前发生故障,可以理解.问题是在payment.asp中显示以od526的单子已经生效,即代码response.redirect "payment.asp?ordercode="& strOrderCode & "&total=" & fltTotal有执行,checkinput函数用以检验客户输入,若是客户输入有问题,那么update语句也不会执行啊.

dat05_order的结果如下:
create table dat05_order_info (
orderid int identity,
total float null,
firstname varchar(20) null,
lastname varchar(20) null,
email varchar(50) null,
priphone varchar(20) null,
secphone varchar(20) null,
icq varchar(20) null,
msn varchar(50) null,
aim varchar(50) null,
yam varchar(50) null,
isfinished bit null default 0,
ordercode varchar(30) null,
adddate smalldatetime null,
isvalid bit null default 0,
memo varchar(100) null,
startdate smalldatetime null,
curlevel int null,
rate varchar(4) null,
lastupdate smalldatetime null,
constraint PK_DAT05_ORDER_INFO primary key (orderid)

在什么情况下会出现上述情况啊,还是代码本身逻辑不够严密,不得其解,请诸位指点.
...全文
评论 7
收藏 已收藏
分享
返回顶部
CodeBeginner
ASP 28,401 成员 356,940 内容