<%
dim ip
ip=Request.ServerVariables("REMOTE_ADDR")
If Request.Form <> "" Then
xh = Trim(Request.Form("xh"))
dd_name = Trim(Request.Form("dd_name"))
bdm = Trim(Request.Form("bdm"))
dd_sfzh = Trim(Request.Form("dd_sfzh"))
dd_jfje = Request.Form("jfje")
dd_skr = Trim(Request.Form("dd_skr"))
dd_skrq= Trim(Request.Form("dd_skrq"))
dd_xl = Trim(Request.Form("dd_xl"))
ip = Trim(Request.Form("dd_ip"))
ip=Request.ServerVariables("REMOTE_ADDR")
'检查结算票据是否用完
dim NRs,No_S,No_E, fph,dd_jfje,dd_xl,dd_name,dd_skr,dd_skrq,dd_sfzh,xh,bdm
set NRs=Conn.Execute("select * from Basic_Info where fp_skr='"&session("UserName")&"'")
No_S=NRs(1)
No_E=NRs(2)
fph=NRs(3)
Set NRs = Nothing
if fph >=No_E then
response.write"<script>alert('设置的结算票据已使用完,请增加!');history.go(-1) ;</script>"
cw=1
end if
'计算结算票据号码
dim l
fph=fph+1
l=len(fph)
if l<>9 then
dim a
for a=1 to 9-l
fph="0" & fph
Next
end if
Conn.Execute("insert into sfxt_dd (xh,dd_name,bdm,dd_sfzh, dd_jfje,fph,dd_skr, dd_xl,dd_skrq,dd_ip ) values ('"& xh &"','"& dd_name &"','"& bdm &"','"& dd_sfzh &"' , '"& dd_jfje &"','"& fph &"', '"& dd_skr &"', '"& dd_xl &"','"& dd_skrq &"','"& ip &"')")
Conn.Execute("update Basic_Info set fph='"&fph&"'where fp_skr='"&session("UserName")&"'")
response.write"<script>alert('缴费成功,打印发票!');window.location='sfxt_dd.asp';</script>"
End If
Set Rs = Nothing
conn.close
set conn=nothing
%>
错误句子:Conn.Execute("insert into sfxt_dd (xh,dd_name,bdm,dd_sfzh, dd_jfje,fph,dd_skr, dd_xl,dd_skrq,dd_ip ) values ('"& xh &"','"& dd_name &"','"& bdm &"','"& dd_sfzh &"' , '"& dd_jfje &"','"& fph &"', '"& dd_skr &"', '"& dd_xl &"','"& dd_skrq &"','"& ip &"')")
把这一句里面的 sql 语句输出一下看看有没有问题,看不出来可以放到数据库中执行一下,哪里有问题改哪里,
可能是某个变量包含不是纯数字,逗号,和英文显得句号
这个都会提示 字符串转换数字失败 "123a" 转换失败
"123.1" "1,234.00" 都会转换成功