标题:向高手请教关于数据库连接的问题
只看楼主
shen8603527
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2004-6-2
 问题点数:0 回复次数:32 
向高手请教关于数据库连接的问题

我是一名初学者,正在学关于asp连接数据库方面的知识以下是一个简单代码

<html> <head> <title>沈龙霖</title> </bead> <body> <% set mydata=server.createobject("adodb.connection") mydata.open "addressdata" mydata.execute("insert into address (name,tel) values('骆莉莉','8809223')") mydata.close set mydata=nothing %> </body> </html>

已在数据源中加入了数据库,可是显示结果说

Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'

[Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。

/index.asp,行 9

请问是为什么,正确的插入语句应该是怎么样的?

搜索更多相关主题的帖子: 数据库 Microsoft mydata 
2004-06-02 23:00
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
得分:0 

mydata.execute("insert into address (name,tel) values("骆莉莉",'8809223')")

看看可以吗?


59ita点com(我就爱TA)
2004-06-02 23:03
shen8603527
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2004-6-2
得分:0 
什么看看可以吗?请问要看什么?

/home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http:///home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-02 23:04
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
得分:0 

我问你可不可以运行???

我建议用驱动而不用数据源


59ita点com(我就爱TA)
2004-06-02 23:07
shen8603527
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2004-6-2
得分:0 
不能啊

/home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http:///home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-02 23:09
shen8603527
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2004-6-2
得分:0 
驱动啊????那个代码怎么写啊

/home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http:///home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-02 23:10
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
得分:0 

<% set conn=server.createobject("adodb.connection") Conn.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("路径和数据库名") & ";" %> <% conn.execute("insert into address (name,tel) values("骆莉莉",'8809223')") mydata.close set mydata=nothing %>


59ita点com(我就爱TA)
2004-06-02 23:16
belin2000
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:975
专家分:194
注 册:2004-6-2
得分:0 

mydata.close set mydata=nothing

改为:conn.close

set conn=nothing


59ita点com(我就爱TA)
2004-06-02 23:18
shen8603527
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2004-6-2
得分:0 

Microsoft VBScript 编译器错误 错误 '800a0408'

无效字符

/index.asp,行 11

conn.execute("insert into address (name,tel) values("骆莉",'8809223')")
这就是结果

/home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http:///home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-02 23:24
shen8603527
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2004-6-2
得分:0 

会不会是其它因啊


/home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http:///home/bbs3/wdb/upload/forum2_f_269_1068812954.jpg');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-02 23:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-1974-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.327399 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved