为什么老是出错啊

x98188 2003-09-09 09:11:52
为什么老是提示错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
/news/webadmin.asp, 第 26 行




coon.asp
<%
Function Deal(exp1)
dim exp2
exp2=Replace(exp1,"<","<")
exp2=Replace(exp2,">",">")
exp2=Replace(exp2,"'","''")
exp2=Replace(exp2,Chr(13),"<br>")
Deal=exp2
End Function
dim conn
dim connstr
dim db
db="db/new.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &

Server.MapPath(db)
'如果你的服务器采用较老版本Access驱动,请用下面连接方法
connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" &

Server.MapPath(db)
conn.Open connstr
%>

webadmin.asp
<!--#include file="conn.asp"-->
<%
title=request.form("title")
comment=request.form("comment")
rectype=trim(request.FORM("type"))
set rs=server.createobject("adodb.recordset")
sql="select * from news"
rs.open sql,conn,1,3
rs.addnew
if rectype="校园新闻" then
rs("news_title")=title
rs("news_comment")=comment
rs("news_news")=-1
rs("news_notice")=0
end if

if rectype="通知" then
rs("news_title")=title
rs("news_comment")=comment
rs("news_news")=0
rs("news_notice")=-1

end if
rs("news_title")=deal(title)
rs("news_comment")=deal(comment)
rs.update
rs.close
set rs=nothing
conn.close
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<form name="form1" method="post" action="webadmin.asp">
<table width="91%" height="228" border="0">
<tr>
<td colspan="2"><div align="center">新闻管理页面 </div></td>
</tr>
<tr>
<td width="27%">新闻类型:<br></td>
<td width="73%"> <select name="type">
<option selected value="校园新闻">校园新闻</option>
<option value="通知">通知</option>
</select> </td>
</tr>
<tr>
<td>新闻标题:(必须)<br></td>
<td><input type="text" name="title"></td>
</tr>
<tr>
<td>新闻内容:<br></td>
<td><textarea name="comment" cols="30" rows="10"></textarea></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</div></td>
</tr>
</table>
</form>

</body>
</html>



...全文
73 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
nchen123 2003-09-09
  • 打赏
  • 举报
回复
把这一句注释掉,connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" &

Server.MapPath(db)

上面用 OLEDB 连接的那一句取消注释,
'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &

Server.MapPath(db)

28,389

社区成员

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

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