| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 452 人关注过本帖
标题:插入错误,继续
只看楼主 加入收藏
xiaohonghui0
Rank: 1
等 级:新手上路
威 望:1
帖 子:274
专家分:0
注 册:2006-4-10
收藏
 问题点数:0 回复次数:2 
插入错误,继续

<%

if(request.form("textfield") <> "") then Command1__textfield = request.form("textfield")

if(request.form("textfield5") <> "") then Command1__textfield5 = request.form("textfield5")

if(request.form("textfield6") <> "") then Command1__textfield6 = request.form("textfield6")

if(request.form("textfield7") <> "") then Command1__textfield7 = request.form("textfield7")

if(request.form("textfield4") <> "") then Command1__textfield4 = request.form("textfield4")

if(request.form("textfield8") <> "") then Command1__textfield8 = request.form("textfield8")

if(request.form("textfield9") <> "") then Command1__textfield9 = request.form("textfield9")

if(request.form("textfield10") <> "") then Command1__textfield10 = request.form("textfield10")

if(request.form("textfield11") <> "") then Command1__textfield11 = request.form("textfield11")

if(request.form("textfield12") <> "") then Command1__textfield12 = request.form("textfield12")

if(request.form("textfield3") <> "") then Command1__textfield3 = request.form("textfield3")

if(request.form("textfield2") <> "") then Command1__textfield2 = request.form("textfield2")

%>
<%

set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_iemm_STRING
Command1.CommandText = "INSERT INTO student (name, address, number, class, borndate, year, fromdate, math, english, chinese, lincenumber, sex) VALUES (" + Replace(Command1__textfield, "'", "''") + "," + Replace(Command1__textfield5, "'", "''") + "," + Replace(Command1__textfield6, "'", "''") + "," + Replace(Command1__textfield7, "'", "''") + "," + Replace(Command1__textfield4, "'", "''") + "," + Replace(Command1__textfield8, "'", "''") + "," + Replace(Command1__textfield9, "'", "''") + "," + Replace(Command1__textfield10, "'", "''") + "," + Replace(Command1__textfield11, "'", "''") + "," + Replace(Command1__textfield12, "'", "''") + "," + Replace(Command1__textfield3, "'", "''") + "," + Replace(Command1__textfield2, "'", "''") + " ) "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>
运行说是我的insert语句错误,是Command1.Execute()处,大家帮我看看

2006-05-16 12:29
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
太乱了,看不明白
估计是某个textfield的值的类型不对,或表字段不允许为空,
原因很多

----我怎能在别人的苦难面前转过脸去----
2006-05-16 16:30
dreame
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:521
专家分:0
注 册:2005-10-23
收藏
得分:0 
lz不好把replace写在sql语句外面的啊?而且看起来都一样的类型??

有时候真的想放弃寂寞的等待,但她是那么的可爱!I love u forever!
2006-05-17 13:13
快速回复:插入错误,继续
数据加载中...
 
   



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

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