asp操作数据库,第一次错误,刷新则正确

hflkl1314 2009-08-03 04:35:15
asp操作数据库,第一次错误,刷新则正确

错误的时候我是用 response.write err.description 获取错误代码,提示“变量未定义”

此时 如果我刷新页面,则提示数据添加成功。 数据库的确是有数据的

这个是什么问题啊
...全文
120 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
samson_www 2009-08-05
  • 打赏
  • 举报
回复
有事务没有关闭,或者使用privide版本不对
hflkl1314 2009-08-04
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 hookee 的回复:]
上面的代码包含在
VBScript codeIfUCase(Request.ServerVariables("HTTP_METHOD"))="POST"Then
...EndIf
中试试看
[/Quote]

我加了这段 还是提示找不到变量
hookee 2009-08-04
  • 打赏
  • 举报
回复
xxid的数据类型是文本?
gxq323 2009-08-03
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 hookee 的回复:]
上面的代码包含在
VBScript codeIfUCase(Request.ServerVariables("HTTP_METHOD"))="POST"Then
...EndIf
中试试看
[/Quote]顶,好方法,学习了
hookee 2009-08-03
  • 打赏
  • 举报
回复
上面的代码包含在
If UCase(Request.ServerVariables("HTTP_METHOD"))="POST" Then
...
End If

中试试看
gxq323 2009-08-03
  • 打赏
  • 举报
回复
看不出错误,看看有没有include文件
hflkl1314 2009-08-03
  • 打赏
  • 举报
回复
xxid=trim(request("xxid"))
ts="0"
xinxipic=trim(request("photo"))
username="youke"
lxrname=trim(request("lxrname"))
usertel=trim(request("usertel"))
phone=trim(request("password"))
company=trim(request("company"))
memo=trim(request("memo"))
yz="0"
youxiao=trim(request("youxiao"))
b="0"
leixing=trim(request("leixing"))
sheng=trim(request("sheng"))
shi=trim(request("shi"))
xiang=trim(request("xiang"))

set rs=server.createobject("adodb.recordset")
sql="select * from [FOX_xinxi] where xxid='"&xxid&"'"
rs.open sql,Conn,1,3
rs.addnew
rs("xxid")=xxid
rs("username")=username
rs("lxrname")=lxrname
rs("usertel")=usertel
rs("phone")=phone
rs("company")=company
rs("memo")=memo
rs("youxiao")=youxiao
rs("leixing")=leixing
rs("sheng")=sheng
rs("shi")=shi
rs("xiang")=xiang
rs("youxiao")=youxiao
if request("b")="" then
rs("b")=0
else
rs("b")=b
end if
rs("huitype")=5
rs("yz")=0
rs("fbsj")=now()
rs("dqsj")=rs("fbsj")+rs("youxiao")
userip=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if userip="" Then
userip=Request.ServerVariables("REMOTE_ADDR")
end if
rs("ip")=userip
rs.update

response.write err.description
response.write err.source
response.write Err.Line


rs.close
set rs=nothing
response.end


不知道哪里出问题了,一定刷新才可以用
dhdhzzw 2009-08-03
  • 打赏
  • 举报
回复
第一次运行有些值得到了,但不正确,再次刷新就填进去了
hookee 2009-08-03
  • 打赏
  • 举报
回复
贴一下代码看看
hflkl1314 2009-08-03
  • 打赏
  • 举报
回复
把Option Explicit注释掉

第一次运行则是空白的
hookee 2009-08-03
  • 打赏
  • 举报
回复
可以把Option Explicit注释掉,可能有一个分支中用到的变量没定义

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧