读书人

提交不了 所以分数都给了 请帮小弟我

发布时间: 2012-03-05 11:54:01 作者: rapoo

在线等 提交不了 所以分数都给了 请帮我
看下我代码吧 数据提交不了

我的代码:

<%
Set Con=Server.CreateObject( "ADODB.connection ")
Con.Open= "File Name=C:\Inetpub\wwwroot\shopping\data\db.udl "
action=trim(Request( "action "))
xm=trim(Request( "xm "))
sheng=trim(Request( "sheng "))
shi=trim(Request( "shi "))
xz=trim(Request( "xz "))
cun=trim(Request( "cun "))
mph=trim(Request( "mph "))
yb=trim(Request( "yb "))
gzdw=trim(Request( "gzdw "))
lxdh=trim(Request( "lxdh "))
dzyx=trim(Request( "dzyx "))

if action= "index " then checkpass=true
if len(xm) <1 then checkpass=false
if len(sheng) <1 then checkpass=false
if len(shi) <1 then checkpass=false
if len(xz) <1 then checkpass=false
if len(cun) <1 then checkpass=false
if len(yb) <1 then checkpass=false
if len(gzdw) <1 then checkpass=false
if len(lxdh) <1 then checkpass=false
if len(dzyx) <1 then checkpass=false

if checkpass then
query= "insert into xinxi(xm, "
query=query& "sheng, "
query=query& "shi, "
query=query& "xz, "
query=query& "cun, "
query=query& "mph, "
query=query& "yb, "
query=query& "gzdw, "
query=query& "lxdh, "
query=query& "dzyx)values( ' "
query=query&xm& " ', ' "
query=query&sheng& " ', ' "
query=query&shi& " ', ' "
query=query&xz& " ', ' "
query=query&cun& " ', ' "
query=query&mph& " ', ' "
query=query&yb& " ', ' "
query=query&gzdw& " ', ' "
query=query&lxdh& " ', ' "
query=query&dzyx& " ') ' "

Con.Execute query

Response.Redirect "index.asp "
end if

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " >

<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 订购页面 </title>
<style type= "text/css ">
<!--
.style7 {
font-size: xx-large;
font-weight: bold;
}
.style11 {font-size: 18px}
-->
</style>
</head>


<body>
<table width= "684 " border= "0 " align= "center " cellpadding= "0 " cellspacing= "0 ">
<tr bgcolor= "#669999 ">
<td height= "64 " colspan= "2 "> <div align= "center "> <span class= "style7 "> 订购人信息 </span> </div> </td>


</tr>
<tr>
<form name= "form1 " method= "post " action= "?action=index ">
<td width= "143 " height= "39 "> <div align= "right "> <span class= "style11 "> 姓名: </span> </div> </td>
<td width= "541 "> <input name= "xm " type= "text " id= "xm " " value= " " style= "width:300px;height:20px "> </td>

<tr>
<td width= "143 " height= "39 "> <div align= "right "> <span class= "style11 "> 详细地址: </span> </div> </td>
<td> <table width= "100% " border= "0 " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td class= "input "> <label for= "sheng ">
<input name= "sheng " type= "text " id= "sheng " " value= " " style= "width:53px;height:20px ">
<label for= "sheng "> 省 </label> </td>
<td class= "input "> <input name= "shi " type= "text " id= "shi " " value= " " style= "width:53px;height:20px ">
<label for= "shi "> 市(区) </label> </td>
<td> <span class= "input ">
<input name= "xz " type= "text " id= "xz " " value= " " style= "width:53px;height:20px ">
<label for= "xz "> 县(镇) </label>
</span> </td>
<td> <span class= "input ">
<input name= "cun " type= "text " id= "cun " " value= " " style= "width:53px;height:20px ">
<label for= "cun "> 村 </label>
</span> </td>
<td> <span class= "input ">
<input name= "mph " type= "text " id= "mph " " value= " " style= "width:53px;height:20px ">


<label for= "mph "> 门牌号 </label>
</span> </td>
</tr>
</table> </td>
</tr>
<tr>
<td width= "143 " height= "39 "> <div align= "right " class= "style11 "> 邮编: </div> </td>
<td> <input name= "yb " type= "text " id= "yb " style= "width:300px;height:20px " value= " "> </td>
</tr>
<tr>
<td width= "143 " height= "39 "> <div align= "right "> <span class= "style11 "> 工作单位 </span> : </div> </td>
<td> <input name= "gzdw " type= "text " id= "gzdw " " value= " " style= "width:300px;height:20px "> </td>
</tr>
<tr>
<td width= "143 " height= "39 "> <div align= "right "> <span class= "style11 "> 联系电话 </span> : </div> </td>
<td> <input name= "lxdh " type= "text " id= "lxdh " " value= " " style= "width:300px;height:20px "> </td>
</tr>
<tr>
<td height= "39 "> <div align= "right " class= "style11 "> 电子邮箱: </div> </td>
<td> <input name= "dzyx " type= "text " id= "dzyx " " value= " " style= "width:300px;height:20px "> </td>
</tr>
<tr>
<td height= "39 ">   </td>
<td height= "39 ">
<input name= "Submit1 " type= "submit " id= "Submit1 " style= "height:20px; font:9pt; " value= "确认提交 " >
</form>
</tr>
</table>
</body>
</html>


[解决办法]
执行下面的语句,把执行结果中State=和SQL=后面的输出贴出来。
<%
Set Con=Server.CreateObject( "ADODB.connection ")
Con.Open= "File Name=C:\Inetpub\wwwroot\shopping\data\db.udl "
Response.Write "State= " & Con.State & " <br> "
action=trim(Request( "action "))
xm=trim(Request( "xm "))
sheng=trim(Request( "sheng "))
shi=trim(Request( "shi "))
xz=trim(Request( "xz "))
cun=trim(Request( "cun "))
mph=trim(Request( "mph "))


yb=trim(Request( "yb "))
gzdw=trim(Request( "gzdw "))
lxdh=trim(Request( "lxdh "))
dzyx=trim(Request( "dzyx "))

if action= "index " then checkpass=true
if len(xm) <1 then checkpass=false
if len(sheng) <1 then checkpass=false
if len(shi) <1 then checkpass=false
if len(xz) <1 then checkpass=false
if len(cun) <1 then checkpass=false
if len(yb) <1 then checkpass=false
if len(gzdw) <1 then checkpass=false
if len(lxdh) <1 then checkpass=false
if len(dzyx) <1 then checkpass=false

if checkpass then
query= "insert into xinxi(xm,sheng,shi,xz,cun,mph,yb,gzdw,lxdh,dzyx) values( ' " & xm & " ', ' " & sheng & " ', ' " & shi & " ', ' " & xz & " ', ' " & cun & " ', ' " & mph & " ', ' " & yb & " ', ' " & gzdw & " ', ' " & lxdh & " ', ' " & dzyx & " ') "

Response.Write "SQL= " & query & " <br> "
Con.Execute query
' Response.Redirect "index.asp "
end if
Con.Close
Set Con = Nothing
%>
...

读书人网 >ASP

热点推荐