各位帮帮忙!为什么有时候可以改数据但有时候又改不了啊

hainanlzp 2003-08-21 12:51:04
代码如下:
<!--#include file="conn.asp"-->
<%
id=request("modifychid")
bt=Request("bt")
fbr=Request("fbr")
lb=Request("mytype")
content=trim(Request("guestcontent"))
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from realty where id="&id
rs2.open sql2,conn,1,3
rs2("title")=bt
rs2("fbr")=fbr
rs2("lb")=lb
rs2("content")=content
rs2.update
rs2.close
set rs2=nothing
Response.Write"<script language=JavaScript>"
Response.Write"alert(""恭喜!信息添加成功"");"
Response.Write"window.location='informanage.asp'"
Response.Write"</script>"
%>
错误是:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
/realty/admin/infor_modifych.asp, 第 20 行
是什么错误的呢,麻烦各位了小弟先谢过了!
...全文
69 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ttt2 2003-08-21
  • 打赏
  • 举报
回复

if not rs2.eof

''''''''这里调式一下是否有该条记录
rs2.open sql2,conn,1,3
rs2("title")=bt
rs2("fbr")=fbr
rs2("lb")=lb
rs2("content")=content
rs2.update
rs2.close
set rs2=nothing
hainanlzp 2003-08-21
  • 打赏
  • 举报
回复
上面的这个搞好了,小弟还有一个问题如下:
错误类型:
Microsoft JET Database Engine (0x80040E14)
/realty/admin/22.asp, 第 12 行
代码如下:
<%
sql="select * from user"
set rs= Server.CreateObject("adodb.recordset")
rs.open sql,conn,1
'set rs=conn.execute(sql)
response.Write("sql")
response.end
%>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr><% do while rs.eof %>
<td><%= rs("userid") %></td>
<td><%= rs("username") %></td>
<td><%= rs("VIP") %></td>
<td><%= rs("retime") %></td>
<% rs.movenext
loop
rs.close
set rs=nothing
%>
</tr>
</table>
是什么原因呢有劳各位了,小弟感激不尽!
hainanlzp 2003-08-21
  • 打赏
  • 举报
回复
conn.asp的代码如下:
<% dim conn,dbpath
set conn=Server.CreateObject("adodb.connection")
dbpath=Server.MapPath("../realty.mdb")
conn.open "Driver={Microsoft Access Driver (*.mdb)};dbq="&dbpath
%>
应该不会有错吧!
ahuiok 2003-08-21
  • 打赏
  • 举报
回复
不会是 conn.asp 与数据库链接的驱动有误么?
hainanlzp 2003-08-21
  • 打赏
  • 举报
回复
id=cint(request("modifychid"))
也不行
hainanlzp 2003-08-21
  • 打赏
  • 举报
回复
可是我用
<%= id %>
<% response.End %>都可以接收的到id的值
还有就是有时候是可以改的,但是有时候又不行了
dufu 2003-08-21
  • 打赏
  • 举报
回复
试试id=cint(request("modifychid"))
muders 2003-08-21
  • 打赏
  • 举报
回复
id取了空值,同意楼楼上的
hainanlzp 2003-08-21
  • 打赏
  • 举报
回复
我用
<%= id %>
<% response.End %>
试过了都行
nightlast 2003-08-21
  • 打赏
  • 举报
回复
注意你的id是否每次都取到值
id=request("modifychid")

28,390

社区成员

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

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