更新数据 急

yymzzl 2006-08-25 11:55:55
<!--#include file="CONN.asp"-->
<%
dim title
dim author
dim content
dim sort
dim Provider
dim DBPath
'dim rs
dim Cursor
dim fobj
dim targetfile
dim txt2

'提取用户提交信息!
title=request.form("标题")
author=request.form("username")
content=HTMLEncode(request.form("content"))
sort=request.form("类别")
function HTMLEncode(content)
if not isnull(content) then
content = replace(content, ">", ">")
content = replace(content, "<", "<")
content = Replace(content, CHR(32), " ")
content = Replace(content, CHR(9), " ")
content = Replace(content, CHR(34), """)
content = Replace(content, CHR(39), "'")
content = Replace(content, CHR(13), "")
content = Replace(content, CHR(10) & CHR(10), "</P><P> ")
content = Replace(content, CHR(10), "<BR> ")
HTMLEncode=content

end if
end function

'连接数据库
' set conn = Server.CreateObject("ADODB.Connection")
' Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
' DBPath="Data Source=" & Server.MapPath("data/db1.mdb")
' conn.Open Provider & DBPath
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sort,conn,Cursor,3
'先经过数据库
rs.AddNew
'把提交内容存到了指定目录下,为一个.asp文件,以便题目连接所指向的内容!
set fobj=server.CreateObject("scripting.FileSystemObject")

'生成一个唯一文件名的文件
dim filename
filename = sort & "/" & Cstr(rss.Fields(0).Value + 1) & ".asp"
targetfile=server.MapPath(filename)
set txt2=fobj.CreateTextFile(targetfile)
txt2.write "<!--#include file=""../html/title.asp""-->"
txt2.Write "<TABLE height= 400 class=columns>"
txt2.Write "<TBODY>"
txt2.Write "<TR>"
txt2.write "<TD class=left>"
txt2.write "<!--#include file=""../html/box_1.asp""-->"
txt2.write "</td>"
txt2.write "<TD class=main>"
txt2.write "<TABLE class=columns align=""center"">"
txt2.write "<TBODY>"
txt2.write "<TR>"
txt2.write "<TD height=""54"">"
txt2.write "<H4>编程探索</H4>"
txt2.write "</td>"
txt2.write "<tr>"
txt2.write "<td>"
txt2.write "文章标题:"
txt2.write title
txt2.write "<br>"
txt2.write "文章类别:"
txt2.write sort
txt2.write "<br>"
txt2.write "作者:"
txt2.write author
txt2.write "<br>"
txt2.write "提交时间:"
txt2.write now
txt2.write "<br>"
txt2.write "<p>"
txt2.Write content
txt2.write "</td></tr>"
txt2.write "</tbody></table>"
txt2.write "</td>"
txt2.write " <TD class=right>"
txt2.write "<!--#include file=""../html/box_4.asp""-->"
txt2.write "<!--#include file=""../html/box_2.asp""-->"
txt2.write "</td>"
txt2.write "</tr>"
txt2.write "</table>"
txt2.write "<!--#include file=""../html/tail.asp""-->"
rs("文章类型")=sort
rs("文章题目")=title
rs("提交作者")=author
rs("提交时间")=now
rs("题目链接")=filename
rs.Update



Response.Write "正在提交....."
Response.Write "<meta http-equiv=refresh content=""3; url=complete.asp"">"
Response.End
end if

----------------------------------------


请各位高人 帮忙 代码有点乱 请问我怎么才能添加这些数据
提示:
Microsoft JET Database Engine 错误 '80040e09'

不能更新。数据库或对象为只读。

/fun_1.asp,行 89


89行 为 rs.addnew
...全文
163 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
jinjuduo 2006-08-25
  • 打赏
  • 举报
回复
估计是权限问题.
右键单击源文件所在的文件夹-->web共享-->权限-->everyone写入权限
flyingsnowy 2006-08-25
  • 打赏
  • 举报
回复
不能更新。数据库或对象为只读。


写不进数据
看数据库属性吧。
aking8736 2006-08-25
  • 打赏
  • 举报
回复
看看数据库的.mdb文件属性是不是为只读
yymzzl 2006-08-25
  • 打赏
  • 举报
回复
问题解决了 谢谢大家帮忙!
yymzzl 2006-08-25
  • 打赏
  • 举报
回复
我的测试了我的另一个网站的 表添加 也不行 ! 但这都是以前做好的东西 在WIN2K都测试完的 为什么到WIN2003 SERVER就不行了???
yymzzl 2006-08-25
  • 打赏
  • 举报
回复
主要我这个东西 在WIN2K 都没问题 主要现在换成 2003 SERVER版了 不知道怎么就执行不了
wansai00 2006-08-25
  • 打赏
  • 举报
回复
自己 调试下! 先随便写个insert试试 如果可以,就是你代码的问题

如果不行,就是ntfs权限的问题了



碰到这类问题,建议写脚本宿主wsf文件进行调试,快捷还方便
yymzzl 2006-08-25
  • 打赏
  • 举报
回复
.MDB属性看过了 是不是代码问题啊? 请高手指教
yzhjisji 2006-08-25
  • 打赏
  • 举报
回复
可以看看你的游标:
我常用rs.open sql,conn,3,3
zxyfp 2006-08-25
  • 打赏
  • 举报
回复
up

28,409

社区成员

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

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