我在用asp插入数据库记录时出现错误,我不知错在哪里?请各位大师明示,谢谢!
我的conn.asp代码:<%dimconn_newsconn_news="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&S...
我的conn.asp代码:
<%
dim conn_news
conn_news="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data\xhnew.mdb")
set conn=Server.CreateObject("ADODB.connection")
conn.open conn_news
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
</body>
</html>
我的new_add.asp代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
name=request.Form("name")
content=request.Form("content")
title=request.Form("title")
exec="insert into aa(name,content,title) values('"+name+"','"+content+"','"+title+"')"
conn_news.execute exec
conn.close
set conn=nothing
response.redirect"index.asp"
%>
</body>
</html>
调试网页时浏览器提示:
·错误类型:
Microsoft VBScript 运行时错误 (0x800A01A8)
缺少对象: 'Provider=Microsoft.J'
/web/trydb/add_new.asp, 第 18 行
18行即“conn_news.execute exec”所在行 展开
<%
dim conn_news
conn_news="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data\xhnew.mdb")
set conn=Server.CreateObject("ADODB.connection")
conn.open conn_news
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
</body>
</html>
我的new_add.asp代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
name=request.Form("name")
content=request.Form("content")
title=request.Form("title")
exec="insert into aa(name,content,title) values('"+name+"','"+content+"','"+title+"')"
conn_news.execute exec
conn.close
set conn=nothing
response.redirect"index.asp"
%>
</body>
</html>
调试网页时浏览器提示:
·错误类型:
Microsoft VBScript 运行时错误 (0x800A01A8)
缺少对象: 'Provider=Microsoft.J'
/web/trydb/add_new.asp, 第 18 行
18行即“conn_news.execute exec”所在行 展开
3个回答
展开全部
同意楼上所说,conn_news.execute exec改成这个conn.execute(exec)
就这一处错误
就这一处错误
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把conn_news.execute exec改成conn.execute exec
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询