ASP 数据库保存问题(100分)

  • 主题发起人 主题发起人 minboy
  • 开始时间 开始时间
M

minboy

Unregistered / Unconfirmed
GUEST, unregistred user!
请教ASP简单的问题,我的save.ASP为什么不能把数据保存到数据库里面那!
下面是两个页面的代码!
conn.asp
<%@LANGUAGE=&quot;VBSCRIPT&quot;
CODEPAGE=&quot;936&quot;%>
<%
'option explicit
dim dataname,starttime,conn,db
response.buffer=true
starttime=timer()*1000
%>
<%
Dim connstr
db=&quot;../jtsc.mdb&quot;
connstr=&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;
& Server.MapPath(db)
On Error Resume Next
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open connstr
If Err then
err.Clear
Set Conn = Nothing
Response.Write &quot;Sorry! 数据库连接出错,请检查连接字串。&quot;
Response.End
End If
%>
________________________________________________________________________________
Add_zj_gzl_save.asp
<!--#include file=&quot;conn.asp&quot;-->
<LINK href=&quot;../main.css&quot;
type=text/css rel=stylesheet>
<%Administer=&quot;01&quot;%>
<!--#include file=&quot;check.asp&quot;
-->
<style>
<!--
.button {
background-image:url(images/bbk.gif);
background-color:#ffffff;
height=20;
font-size:12px;
border:#666666 1px solid
}
-->
</style>
<!--#include file=&quot;Message.asp&quot;
-->
<%if request(&quot;year&quot;)=&quot;&quot;
then
%>
<script language=javascript>
alert( &quot;错误:请选择年份!&quot;
);
location.href = &quot;javascript:history.back()&quot;

</script>
<%response.end
end if%>
<%if request(&quot;month&quot;)=&quot;&quot;
then
%>
<script language=javascript>
alert( &quot;错误:请选择月份”!&quot;
);
location.href = &quot;javascript:history.back()&quot;

</script>
<%response.end
end if%>
<%if request(&quot;day&quot;)=&quot;&quot;
then
%>
<script language=javascript>
alert( &quot;错误:请选择日期!&quot;
);
location.href = &quot;javascript:history.back()&quot;

</script>
<%response.end
end if%>


<%
message=&quot;&quot;
years=Request.Form(&quot;year&quot;)
if len(Request.Form(&quot;month&quot;))=1 then
months=&quot;0&quot;&Request.Form(&quot;month&quot;)
else
months=Request.Form(&quot;month&quot;)
end if
if len(Request.Form(&quot;day&quot;))=1 then
days=&quot;0&quot;&Request.Form(&quot;day&quot;)
else
days=Request.Form(&quot;day&quot;)
end if
set rs=server.createobject(&quot;adodb.recordset&quot;)
sql=&quot;select * from SCXX_ZJ_GZL&quot;
rs.open sql,conn,1,3
rs.addnew
rs(&quot;tjrq&quot;)=years&&quot;-&quot;&months&&quot;-&quot;&days
rs(&quot;rjc&quot;)=trim(request.Form(&quot;rjc&quot;))
rs(&quot;ylj&quot;)=trim(request.Form(&quot;ylj&quot;))
rs(&quot;ylh&quot;)=trim(request.Form(&quot;ylh&quot;))
rs(&quot;bfb&quot;)=trim(request.Form(&quot;bfb&quot;))
rs(&quot;nlj&quot;)=trim(request.Form(&quot;nlj&quot;))
rs(&quot;nkjs&quot;)=trim(request.Form(&quot;nkjs&quot;))
rs(&quot;nwjs&quot;)=trim(request.Form(&quot;nwjs&quot;))
rs(&quot;nzqgc&quot;)=trim(request.Form(&quot;nzqgc&quot;))
rs(&quot;njdbq&quot;)=trim(request.Form(&quot;njdbq&quot;))
rs(&quot;dyzj&quot;)=trim(request.Form(&quot;dyzj&quot;))
rs(&quot;zc&quot;)=trim(request.Form(&quot;zc&quot;))
rs(&quot;wj&quot;)=trim(request.Form(&quot;wj&quot;))
rs(&quot;bq&quot;)=trim(request.Form(&quot;bq&quot;))
rs(&quot;az&quot;)=trim(request.Form(&quot;az&quot;))
rs(&quot;jx&quot;)=trim(request.Form(&quot;jx&quot;))
rs(&quot;zt&quot;)=trim(request.Form(&quot;zt&quot;))
rs(&quot;fz&quot;)=trim(request.Form(&quot;fz&quot;))
rs(&quot;sg&quot;)=trim(request.Form(&quot;sg&quot;))
rs(&quot;zx&quot;)=trim(request.Form(&quot;zx&quot;))
rs(&quot;qt&quot;)=trim(request.Form(&quot;qt&quot;))
rs(&quot;dc&quot;)=trim(request.Form(&quot;dc&quot;))
rs(&quot;gj&quot;)=trim(request.Form(&quot;gj&quot;))
rs(&quot;other&quot;)=trim(request.Form(&quot;other&quot;))

rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<head></head>
<div align=&quot;center&quot;>
<center>
<table border=&quot;1&quot;
width=&quot;450&quot;
cellspacing=&quot;0&quot;
cellpadding=&quot;3&quot;
bordercolorlight=&quot;#FFCC00&quot;
bordercolor=&quot;#FFCC00&quot;>
<tr>
<td width=&quot;100%&quot;
bgcolor=&quot;#FFCC00&quot;>提示信息>>><font color=red><b>Succeed!添加信息成功!</b></font></td>
</tr>
<tr>
<td width=&quot;100%&quot;>
<table border=&quot;1&quot;
width=&quot;100%&quot;
cellspacing=&quot;0&quot;
cellpadding=&quot;2&quot;
bordercolorlight=&quot;#000000&quot;
bordercolordark=&quot;#FFFFFF&quot;
bordercolor=&quot;#000000&quot;>
<tr>
<td width=&quot;100%&quot;
align=&quot;center&quot;
colspan=&quot;2&quot;><font color=red><b>Succeed!添加信息成功!您向数据库中添加的如下信息已经成功保存...</b></font></td>
</tr>
<tr>
<td width=&quot;100%&quot;
align=&quot;center&quot;
colspan=&quot;2&quot;>
<input type=button class=&quot;button&quot;
name=&quot;Submit&quot;
value=&quot;继续添加&quot;
onClick=&quot;location.href='Add_zj_GZL.asp'&quot;></td>
</tr>
</center>
</table>
</td>
</tr>
<center>
<tr>
<td width=&quot;100%&quot;
bgcolor=&quot;#FFCC00&quot;>
<p align=&quot;center&quot;>版权所有:青海石油管理局钻井公司
技术支持电话:8911367</p>
</td>
</tr>
</table>
</center>
</div>
 
我决得这个网址大全很实用的,请大家多多支持
http://16311.855.com
 
后退
顶部