| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 483 人关注过本帖
标题:[求助]为什么插入不了数据库呢??
只看楼主 加入收藏
zmyzzz
Rank: 1
等 级:新手上路
帖 子:145
专家分:0
注 册:2005-9-21
收藏
 问题点数:0 回复次数:2 
[求助]为什么插入不了数据库呢??

为什么插入不了数据库呢??没有错误提示......
而且能显示 数据已成功录入,谢谢!!
但实际上没有插进去.............
代码如下:
<!--#include file="Conn.asp"-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>信息录入</title>
<style type="text/css">
<!--
.style7 {font-family: "黑体"; font-size: 10pt; }
.style8 {font-size: 10pt}
.style9 {font-family: "黑体"}
.style15 {font-size: 10pt; font-family: "宋体"; }
-->
</style>
<script language="vbscript">
sub checkform()
if trim(form1.select.value)="" then
msgbox("请选择项目!")
form1.select.focus()
window.event.returnValue=false
return
end if
end sub
</script>
</head>


<body>
<%
sub assignHowMuch()
%>
<form action="" method="post" name="form1" class="style7" onsubmit="checkform()">
请输入您所要输入的项目:
<%
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from xiangmu"
rs.open sql, conn, 1, 1
%>
<select name="select">
<option selected>请选择</option>
<%while not rs.eof%>
<option value="<%=rs("xm_name")%>"><%=rs("xm_name")%></option>
<% rs.movenext
wend%>
</select>
请输入录入的条数:
<input name="textid" type="text" id="textid" size="4" maxlength="4">
<input type="submit" name="Submit" value="下一步&gt;&gt;">
</form>
<%
end sub
sub Inputdata()
call assignHowMuch()
dim recCnt,i
%>
<form name="form2" method="post" action="">
<table width="80%" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000" style="border-collapse: collapse">
<%
recCnt=cint(request.form("textid"))
xiangmu=request.form("select")
for i=1 to recCnt
%>
<tr>
<td width="3%" nowrap><span class="style7"><%=i%></span></td>
<td width="22%" nowrap><div align="left" class="style8"><span class="style9">电话:
<input name="textphone" type="text" id="textphone" size="12" maxlength="11">
</span></div></td>
<td width="22%" nowrap><div align="left" class="style15">发展人:
<input name="textfield" type="text" size="10" maxlength="10">
</div></td>
<td width="10%" nowrap class="style9"><div align="right" class="style15 style8">发展时间:</div></td>
<td width="14%" nowrap class="style9"><div align="left" class="style15"><%=now()%>
<input name="textdate" type="hidden" id="textdate" value="<%=now()%>">
</div></td>
<td width="11%" nowrap class="style9"><div align="right" class="style15">发展项目:</div></td>
<td width="18%" nowrap class="style9"><span class="style15"><%=xiangmu%>
<input name="textxiangmu" type="hidden" id="textxiangmu" value="<%=xiangmu%>">
<input name="reccint" type="hidden" id="reccint" value="<%=recCint%>">
</span></td>
</tr>
<%next%>
</table>
<input name="Submit" type="submit" id="Submit" value="提交">
</form>
<%end sub%>
<%sub writedata()
dim reccnt,i
dim phone,fname,datetime,xianmgu
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from fazhan"
rs.open sql,conn,3,3
reccnt=cint(request.form("reccnt"))
for i=1 to reccint
phone=trim(request.form("textphone")(i))
fname=trim(request.form("textfield")(i))
datetime=request.form("textdate")(i)
xiangmu=trim(request("textxiangmu")(i))
rs.addnew
rs("phone")=phone
rs("fazhanren")=fname
rs("date_time")=datetime
rs("xiangmu")=xiangmu
rs.update
next
rs.close
conn.close
set conn=nothing
response.write "数据已成功录入,谢谢!!"
end sub
%>
<%if request.form("Submit")="下一步>>" then
call InputData()
elseif request.form("Submit")="提交" then
call writedata()
else
call assignHowMuch()
end if
%>
<p>&nbsp; </p>
</body>
</html>
谁能帮我看看啊...谢谢........

搜索更多相关主题的帖子: 数据库 dtd loose title 
2006-03-15 16:40
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
你先看看你的conn.asp里面有没有on error resume next 要是有先注释掉再看看
2006-03-15 17:19
zmyzzz
Rank: 1
等 级:新手上路
帖 子:145
专家分:0
注 册:2005-9-21
收藏
得分:0 
没有哦....
我的conn.asp就是这几句....
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
dim conn,db
db="/data/jituan.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
%>

[此贴子已经被作者于2006-3-16 12:52:14编辑过]


吾尝终日而思之,不如须臾之所学也
2006-03-16 12:52
快速回复:[求助]为什么插入不了数据库呢??
数据加载中...
 
   



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

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