更新数据 急
<!--#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