| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 683 人关注过本帖
标题:数据写不进数据库的问题
只看楼主 加入收藏
白永浩
Rank: 1
来 自:浙江温州
等 级:新手上路
帖 子:101
专家分:0
注 册:2006-3-23
收藏
 问题点数:0 回复次数:4 
数据写不进数据库的问题

我的数据表byh_customer的结构是这样的: (问题是:我提交的内容除了日期跟byh_customer_id以外都写不进去..其他字段都是空的,...)请高手帮忙诊断

byh_customer_id ccompany cname csex ...................... ......填单日期
. . . . .
.
.
.
我的处理程序checkdd_cn.asp是这样的:

<%


if request.querystring("action")="checkdd_cn" then

tcompanyname=request("companyname")
tcustomername=request("customername")
tcustomersex=request("customersex")
tcustomertel=request("customertel")
tcustomeremail=request("customeremail")
tproduct=request("product")
tproductn=request("productn")
tspdate=request("spdate")


set rs=server.createobject("adodb.recordset")
sqlstr="select byh_customer_id,ccompany,cname,csex,ctel,cemail,product,productn,交货日期,填单日期 from byh_customer"
rs.Open sqlstr,conn,3,3

rs.addnew
rs("ccompany")=tcompanyname
rs("cname")=tcustomername
rs("csex")=tcustomersex+" "
rs("ctel")=tcustomertel
rs("cemail")=tcustomeremail+" "
rs("product")=tproduct
rs("productn")=tproductn
rs("交货日期")=tspdate
rs("填单日期")=date+time
rs.update
rs.close
set rs=nothing
set conn=nothing
%>


<script language=vbscript>
msgbox "提交成功!"
window.location="wsdd_cn.asp"

</script>
<%end if%>

<head>
<title><%=byh_site_name%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="<%=byh_site_key%>">

<LINK href="style.css" type=text/css rel=stylesheet>
</head>

<body background="kl_image/topbg.jpg">


<!--#include file="top_cn.asp"-->
<TABLE width=778 height=490 border=0 align="center" cellPadding=0 cellSpacing=0 id=table1>
<TBODY>
<TR>
<TD vAlign=top align=middle width=778>

<TABLE id=table23 height=198 cellSpacing=0 cellPadding=0 width=778
border=0>
<TBODY>
<TR>
<TD align=middle width=180 rowSpan=4 height="55"> <!--#include file="left_cn.asp"--></TD>
<TD width=598 colSpan=3 height=34> <P align=center><FONT color=#cc3300 size=3>
网上订单</FONT></P></TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=12></TD>
</TR>
<TR>
<TD width=68 height="33"></TD>
<TD vAlign=top width=462 height="33">

<form method="POST" action="?action=checkdd_cn">

<%

tcompanyname=request("companyname")
tcustomername=request("customername")
tcustomersex=request("customersex")
tcustomertel=request("customertel")
tcustomeremail=request("customeremail")
tproduct=request("product")
tproductn=request("productn")
tspdate=request("spdate")

if tcompanyname ="" then%>
<script language="vbScript">msgbox "对不起,公司名不能为空!"
window.history.go(-1)
</script>
<% response.End()
end if
if tcustomername ="" then%>
<script language="vbScript">msgbox "对不起,用户名不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tcustomertel ="" then%>
<script language="vbScript">msgbox "对不起,电话号码不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tproduct ="" then%>
<script language="vbScript">msgbox "对不起,产品型号不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tproductn ="" then%>
<script language="vbScript">msgbox "对不起,定做数量不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tspdate ="" then%>
<script language="vbScript">msgbox "对不起,交货日期不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

%>

<p>您填写的内容是:</p>
<table border="1" width="50%" height="142">
<tr>
<td width="50%" height="12">公司名称:</td>
<td width="50%" height="12"><%=tcompanyname%> <input type=hidden name=tcompany value=<%=tcompanyname%>></td>
</tr>
<tr>
<td width="50%" height="10">客户姓名:</td>
<td width="50%" height="10"><%=tcustomername%> <input type=hidden name=tname value=<%=tcustomername%>></td>
</tr>
<tr>
<td width="50%" height="12">性别:</td>
<td width="50%" height="12"><%=tcustomersex%><input type=hidden name=tsex value=<%=tcustomersex%>></td>
</tr>
<tr>
<td width="50%" height="12">联系电话:</td>
<td width="50%" height="12"><%=tcustomertel%><input type=hidden name=ttel value=<%=tcustomertel%>></td>
</tr>
<tr>
<td width="50%" height="12">E-mail:</td>
<td width="50%" height="12"><%=tcustomeremail%> <input type=hidden name=temail value=<%=tcustomeremail%>></td>
</tr>
<tr>
<td width="50%" height="12">产品型号:</td>
<td width="50%" height="12"><%=tproduct%><input type=hidden name=tproduct value=<%=tproduct%>> </td>
</tr>
<tr>
<td width="50%" height="12">定做数量:</td>
<td width="50%" height="12"><%=tproductn%><input type=hidden name=tproductn value=<%=tproductn%>></td>
</tr>
<tr>
<td width="50%" height="12">交货日期:</td>
<td width="50%" height="12"><%=tspdate%><input type=hidden name=tjhrq value=<%=tspdate%>></td>
</tr>

</table>


<p><input type="submit" value="确定" name="B3" ><input type="button" onclick="window.location.href='wsdd_cn.asp'" value="返回重写" name="B2" ></p>
</form>
</TD>
<TD width=68 height="33"> </TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=1> </TD>
</TR>
<TR>
<TD width=180 height=143 rowSpan=3> </TD>
<TD vAlign=top width=598 colSpan=3 height=105> 
<HR SIZE=1> <FONT size=2><BR>
</FONT><FONT
size=2 ><%=byh_site_copyright%></FONT>
<P align=center><BR>
<FONT size=2><FONT
color=#ff3333>白永浩设计</FONT>制作维护&nbsp; <A
href="mailto:ssd858@126.com">ssd858@126.com</A></FONT></P></TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=21> <HR SIZE=1> </TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=17> <P align=center>&copy;
2006 KERY STATIONERY CO.,LTD All right reserved. </P></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>

搜索更多相关主题的帖子: 数据库 
2006-11-18 12:54
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 
以下是引用白永浩在2006-11-18 12:54:08的发言:

我的数据表byh_customer的结构是这样的: (问题是:我提交的内容除了日期跟byh_customer_id以外都写不进去..其他字段都是空的,...)请高手帮忙诊断

byh_customer_id ccompany cname csex ...................... ......填单日期
. . . . .
.
.
.
我的处理程序checkdd_cn.asp是这样的:

<%


if request.querystring("action")="checkdd_cn" then

这些代码怎么在下面也有啊!有一个就可以了!

tcompanyname=request("companyname")
tcustomername=request("customername")
tcustomersex=request("customersex")
tcustomertel=request("customertel")
tcustomeremail=request("customeremail")
tproduct=request("product")
tproductn=request("productn")
tspdate=request("spdate")


set rs=server.createobject("adodb.recordset")
sqlstr="select byh_customer_id,ccompany,cname,csex,ctel,cemail,product,productn,交货日期,填单日期 from byh_customer"

这段代码可不可以简化一下啊!

例如:sqlstr="select * from byh_customer"

这样的话就是查找表中的所有数据!~就不会出现有掉了的情况!

rs.Open sqlstr,conn,3,3

rs.addnew
rs("ccompany")=tcompanyname
rs("cname")=tcustomername
rs("csex")=tcustomersex+" "
rs("ctel")=tcustomertel
rs("cemail")=tcustomeremail+" "

这里的tcustomeremail+" "是啥意思来着!


rs("product")=tproduct
rs("productn")=tproductn
rs("交货日期")=tspdate
rs("填单日期")=date+time

这个我就不懂了,也许我没有看你的后面的表单,你的date+time是什么意思呢!

你是不是想显示:2006-11-18 12:02:66啊!如果是的话就直接用Now()函数就可以了!

rs.update
rs.close
set rs=nothing
set conn=nothing
%>


<script language=vbscript>
msgbox "提交成功!"
window.location="wsdd_cn.asp"

</script>
<%end if%>

<head>
<title><%=byh_site_name%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="<%=byh_site_key%>">

<LINK href="style.css" type=text/css rel=stylesheet>
</head>

<body background="kl_image/topbg.jpg">


<!--#include file="top_cn.asp"-->
<TABLE width=778 height=490 border=0 align="center" cellPadding=0 cellSpacing=0 id=table1>
<TBODY>
<TR>
<TD vAlign=top align=middle width=778>

<TABLE id=table23 height=198 cellSpacing=0 cellPadding=0 width=778
border=0>
<TBODY>
<TR>
<TD align=middle width=180 rowSpan=4 height="55"> <!--#include file="left_cn.asp"--></TD>
<TD width=598 colSpan=3 height=34> <P align=center><FONT color=#cc3300 size=3>
网上订单</FONT></P></TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=12></TD>
</TR>
<TR>
<TD width=68 height="33"></TD>
<TD vAlign=top width=462 height="33">

<form method="POST" action="?action=checkdd_cn">

<%

tcompanyname=request("companyname")
tcustomername=request("customername")
tcustomersex=request("customersex")
tcustomertel=request("customertel")
tcustomeremail=request("customeremail")
tproduct=request("product")
tproductn=request("productn")
tspdate=request("spdate")

if tcompanyname ="" then%>
<script language="vbScript">msgbox "对不起,公司名不能为空!"
window.history.go(-1)
</script>
<% response.End()
end if
if tcustomername ="" then%>
<script language="vbScript">msgbox "对不起,用户名不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tcustomertel ="" then%>
<script language="vbScript">msgbox "对不起,电话号码不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tproduct ="" then%>
<script language="vbScript">msgbox "对不起,产品型号不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tproductn ="" then%>
<script language="vbScript">msgbox "对不起,定做数量不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

if tspdate ="" then%>
<script language="vbScript">msgbox "对不起,交货日期不能为空!"
window.history.go(-1)
</script>
<%response.End()
end if

%>

<p>您填写的内容是:</p>
<table border="1" width="50%" height="142">
<tr>
<td width="50%" height="12">公司名称:</td>
<td width="50%" height="12"><%=tcompanyname%> <input type=hidden name=tcompany value=<%=tcompanyname%>></td>
</tr>
<tr>
<td width="50%" height="10">客户姓名:</td>
<td width="50%" height="10"><%=tcustomername%> <input type=hidden name=tname value=<%=tcustomername%>></td>
</tr>
<tr>
<td width="50%" height="12">性别:</td>
<td width="50%" height="12"><%=tcustomersex%><input type=hidden name=tsex value=<%=tcustomersex%>></td>
</tr>
<tr>
<td width="50%" height="12">联系电话:</td>
<td width="50%" height="12"><%=tcustomertel%><input type=hidden name=ttel value=<%=tcustomertel%>></td>
</tr>
<tr>
<td width="50%" height="12">E-mail:</td>
<td width="50%" height="12"><%=tcustomeremail%> <input type=hidden name=temail value=<%=tcustomeremail%>></td>
</tr>
<tr>
<td width="50%" height="12">产品型号:</td>
<td width="50%" height="12"><%=tproduct%><input type=hidden name=tproduct value=<%=tproduct%>> </td>
</tr>
<tr>
<td width="50%" height="12">定做数量:</td>
<td width="50%" height="12"><%=tproductn%><input type=hidden name=tproductn value=<%=tproductn%>></td>
</tr>
<tr>
<td width="50%" height="12">交货日期:</td>
<td width="50%" height="12"><%=tspdate%><input type=hidden name=tjhrq value=<%=tspdate%>></td>
</tr>

</table>


<p><input type="submit" value="确定" name="B3" ><input type="button" onclick="window.location.href='wsdd_cn.asp'" value="返回重写" name="B2" ></p>
</form>
</TD>
<TD width=68 height="33"> </TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=1> </TD>
</TR>
<TR>
<TD width=180 height=143 rowSpan=3> </TD>
<TD vAlign=top width=598 colSpan=3 height=105> 
<HR SIZE=1> <FONT size=2><BR>
</FONT><FONT
size=2 ><%=byh_site_copyright%></FONT>
<P align=center><BR>
<FONT size=2><FONT
color=#ff3333>白永浩设计</FONT>制作维护&nbsp; <A
href="mailto:ssd858@126.com">ssd858@126.com</A></FONT></P></TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=21> <HR SIZE=1> </TD>
</TR>
<TR>
<TD vAlign=top width=598 colSpan=3 height=17> <P align=center>&copy;
2006 KERY STATIONERY CO.,LTD All right reserved. </P></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>


程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2006-11-18 13:21
白永浩
Rank: 1
来 自:浙江温州
等 级:新手上路
帖 子:101
专家分:0
注 册:2006-3-23
收藏
得分:0 
哦,多谢了,改了
可是还是不行......依然跟以前一样.数据没写进去,但程序也没有出错....

欢迎光临博智皮具!www.
2006-11-18 14:08
tang688
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1219
专家分:35
注 册:2004-12-25
收藏
得分:0 
如果你写了数据,它不出错,但又写不进的原因有以下几种可能:
1、你用了on error resumnext,这一句可能在包含文件中。
2、你写错了数据库、表等(就是你写在了别处,你又在这个地方看)。
3、你的IIS出问题了(或者是设置上的问题)。

[此贴子已经被作者于2006-11-18 16:45:03编辑过]


2006-11-18 16:40
白永浩
Rank: 1
来 自:浙江温州
等 级:新手上路
帖 子:101
专家分:0
注 册:2006-3-23
收藏
得分:0 
哦...我查查看啊
先谢谢版主了

欢迎光临博智皮具!www.
2006-11-18 17:48
快速回复:数据写不进数据库的问题
数据加载中...
 
   



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

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