| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 836 人关注过本帖
标题:求助,没有出错信息,不能在数据库里加入记录,急
只看楼主 加入收藏
aspszl
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-10-5
收藏
 问题点数:0 回复次数:2 
求助,没有出错信息,不能在数据库里加入记录,急
下边这个是addcopier.asp文件
<% 
set cn= Server.CreateObject("adodb.connection")
cn.open "DBQ="+server.mappath("./Copier.mdb")+";DRIVER={Microsoft Access Driver (*.mdb)};"
set rst= Server.CreateObject("adodb.recordset") 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>增加复印项目</title>
</head>

<body>
<% 
strtype=Trim(request.Form("strtype")) 
gradation=trim(request.Form("gradation"))
maxram=trim(request.Form("maxram"))
Ram=trim(request.Form("Ram"))
yutime=trim(request.Form("yutime"))
power=trim(request.Form("power"))
weight=trim(request.Form("weight"))
standardpager=trim(request.Form("standardpager"))
maxpager=trim(request.Form("maxpager"))
speed=trim(request.Form("speed"))
firsttime=trim(request.Form("firsttime"))
fenbianl=trim(request.Form("fenbianl"))
mulpower=trim(request.Form("mulpower"))
maxpage=trim(request.Form("maxpage"))
printspeed=trim(request.Form("printspeed"))
printram=trim(request.Form("printram"))
printinf=trim(request.Form("printinf"))
printscript=trim(request.Form("printscript"))
plate=trim(request.Form("plate"))

if gradation=""then
gradation="/"
end if
if standardpager=""then
standardpager="/"
end if
if maxpager=""then
maxpager="/"
end if
if speed=""then
speed="/"
end if
if maxpage=""then
maxpage="/"
end if
if printspeed=""then
printspeed="/"
end if
if printram=""then
printram="/"
end if
if printinf=""then
printinf="/"
end if
if printscript=""then
printscript="/"
end if
if plate<>"" and strtype<>"" and ram<>"" and maxram<>"" and yutime<>"" and power<>"" and weight<>"" and firsttime<>"" and fenbianl<>"" and mulpower<>"" then
values="'"&plate&"','"&strtype&"','"&ram&"','"&maxram&"','"&yutime&"','"&power&"','"&weight&"','"&firsttime&"','"&fenbianl&"','"&mulpower&"'"
values=values&gradation&"','"&standardpager&"','"&maxpager&"','"&speed&"','"&maxpage&"','"&printspeed&"','"&printram&"','"&printinf&"','"&printscript&"'"
sqlstr="insert into copier values('"&plate&"','"&strtype&"','"&ram&"','"&maxram&"','"&yutime&"','"&power&"','"&weight&"','"&firsttime&"','"&fenbianl&"','"&mulpower&"','"&gradation&"','"&standardpager&"','"&maxpager&"','"&speed&"','"&maxpage&"','"&printspeed&"','"&printram&"','"&printinf&"','"&printscript&")"
rst.open sqlstr,cn
Response.Write("增加成功")
cn.close 
else
response.Redirect("addcopier.htm")
end if
%>
</body>
</html>


下边这个是addcopier.htm文件内容
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>复印标配</title>
<style type="text/css">
<!--
.style1 {
 font-size: 18px;
 font-weight: bold;
}
.style2 {
 font-size: 36px;
 font-weight: bold;
 color: #0000FF;
}
-->
</style>
</head>

<body>
<div align="center"><span class="style2">复印标配</span>
</div>
<center>
<form name="form" method="post" action="addCopier.asp">
<p><span class="style1">复印规格</span></p>
<p>类型:
<input name="strtype" type="text" id="strtype" size="20">
     预热时间:小于
<input name="yutime" type="text" id="yutime" size="12">
秒 </p>
 内存:
<input name="Ram" type="text" id="Ram" size="19">
M
     标配容量:
<input name="standardpager" type="text" id="standardpager" size="18"> 
张
<p> 功率:
<input name="power" type="text" id="power" size="19">
KW
    最大容量:
<input name="maxpager" type="text" id="maxpager" size="18"> 
张</p>
<p> 灰度:
<input name="gradation" type="text" id="gradation" size="19">
      复印速度:
<input name="speed" type="text" id="speed" size="15">
张/分
</p>
<p>  重量:
<input name="weight" type="text" id="weight" size="16">
KG
       连续复印:
<input name="maxpage" type="text" id="maxpage" size="18">
张
</p>
<p>倍率:
<input name="mulpower" type="text" id="mulpower" size="20">
     分辨率: 
<input name="fenbianl" type="text" id="fenbianl" size="20">
</p>
<p>首张时间:小于
<input name="firsttime" type="text" id="firsttime" size="12">
秒     最大内存:
<input name="maxpage" type="text" id="maxpage" size="17">
M
</p>
<p class="style1">打印规格</p>
<p>内存:
<input name="printram" type="text" id="printram" size="20">
     打印速度:
<input name="printspeed" type="text" id="printspeed" size="15">
张/分</p>
<p>接口:
<input name="printinf" type="text" id="printinf" size="20">
     打印语言:
<input name="printscript" type="text" id="printscript" size="20">
</p>
<p><span class="style1">传真规格</span></p>
<p>厂家:
<input name="plate" type="text" id="plate">
</p>
<p>
<input type="submit" name="Submit" value="提交">
        
<input type="reset" name="Submit2" value="重置">
</p>
</form>
</center>
</body>
</html>
搜索更多相关主题的帖子: 数据库 记录 
2004-10-05 13:30
javame
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2004-10-5
收藏
得分:0 

应该要在加入rst.update (嘻嘻,我不是高手,我只是初学者,说错莫怪!!)

2004-10-05 21:26
在乎
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2004-10-6
收藏
得分:0 

这个程序少了很多东西,也乱弄了.

应先在第一个程序头加入判断是否为表单提交.if request.servervariables("request_method")=post then

中间代码,

else

response.redirect "addcopier.htm"

end if

其中代码部分少了执行导入记录的语句:

rs.execute .....

2004-10-06 01:17
快速回复:求助,没有出错信息,不能在数据库里加入记录,急
数据加载中...
 
   



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

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