注册 登录
编程论坛 ASP技术论坛

版主 大侠出来看看吧

kevinxu0638 发布于 2011-12-08 10:20, 730 次点击
程序代码:
add.asp
---------------------
<%@LANGUAGE="VBSCRIPT"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>

<body>
<table width="100%" border="0" bgcolor="#FFFF99">
  <tr>
  <td colspan="4"><h2 align="center"><span class="STYLE3">*</span>鑫远物流仓库出入库信息录入<span class="STYLE3">*</span></h2>
  </tr>
  <tr>
    <td colspan="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <div align="right"><a href="index.asp">首页</a> <a href="select.asp">查询</a>
        <br>   
      </div></td>
  </tr>
  <tr>
    <td><center>
<table width="58%" height="100%" border="1">
<form name="form1" method="post" action="insert.asp">
<tr bgcolor="#0066FF">
<td colspan="2"><div align="center"></div></td>
</tr>
            <tr bgcolor="#0066FF">
              <td width="27%" bgcolor="#0066FF"><div align="center">流水编号</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center"><input name="lsbh" type="text" id="lsbh" value="无记录" />
              </div></td>
            </tr>
            <tr bgcolor="#0066FF">
              <td width="27%" bgcolor="#0066FF"><div align="center">出/入</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center"><input name="cr" type="text" id="cr" value="无记录" />
              </div></td>
            </tr>
            <tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">日期</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                <input name="time" type="text" id="time" value="无记录" />
              </div></td>
            </tr>
            <tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">业务类别</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                <input name="ywlb" type="text" id="ywlb" value="无记录" />
              </div></td>
            </tr>
            <tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">批号/品名</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                <input name="tdh" type="text" id="tdh" value="无记录" />
              </div></td>
            </tr>
            <tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">货代</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                <input name="hd" type="text" id="hd" value="无记录" />
              </div></td>
            </tr>
            <tr>
              <td bgcolor="#0066FF"><div align="center">重量</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                <input name="zl" type="text" id="zl" value="无记录" />
              </div></td>
            </tr>
            <tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">体积</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                <input name="tj" type="text" id="tj" value="无记录" />
              </div></td>
            </tr>
             <tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">入库数量</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                <input name="rksl" type="text" id="rksl" value="无记录" />
              </div></td>
            <tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">出库数量</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                  <input name="cksl" type="text" id="cksl" value="无记录" />
              </div></td>
<tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">运输车号</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                  <input name="ysch" type="text" id="ysch" value="无记录" />
              </div></td>
<tr>
              <td width="27%" bgcolor="#0066FF"><div align="center">备注</div></td>
              <td width="73%" bgcolor="#0066FF"><div align="center">
                  <input name="bz" type="text" id="bz" value="无记录" />
              </div></td>
<tr>
<td align="center" colspan="2"><span class="STYLE2">
  <input type="submit" value="添加">
  &nbsp;&nbsp;
  <input type="reset" value="重置">
  &nbsp;&nbsp;<a href="index.asp">取消</a></span></td>
</tr>
</form>
</table>
</center>
</table>
</body>
</html>insert.asp
-------------------------------------
<% Option Explicit %>
    <%
   
Dim db
   
Set db=Server.CreateObject("ADODB.Connection")
    db.Open
"table"
   
dim strSql,strlsbh,strcr,strtime,strywlb,strtdh,strhd,strzl,strtj,strrksl,strcksl,strysch,strbz
strlsbh
=request.form("lsbh")
strcr
=request.form("cr")
strtime
=request.form("time")
strywlb
=request.form("ywlb")
strtdh
=request.form("tdh")
strhd
=request.form("hd")
strzl
=request.form("zl")
strtj
=request.form("tj")
strrksl
=request.form("rksl")
strcksl
=request.form("cksl")
strysch
=request.form("ysch")
strbz
=request.form("bz")

strsql
="insert into 2011 (lsbh,cr,time,ywlb,tdh,hd,zl,tj,rksl,cksl,ysch,bz) values ('"&strlsbh&"','"&strcr&"','"&strtime&"','"&strywlb&"','"&strtdh&"','"&strhd&"','"&strzl&"','"&strtj&"','"&strrksl&"','"&strcksl&"','"&strysch&"','"&strbz&"')"
    db.Execute(strSql)  
Response.Redirect
"add.asp"
%>
-------------------------
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。
/xywl/insert.asp, 第 21 行(db.Execute(strSql)  应该是strsql这错误 但我找不出来 符号我都查几遍了)



[ 本帖最后由 kevinxu0638 于 2011-12-8 10:21 编辑 ]
8 回复
#2
kevinxu06382011-12-08 14:39
没人帮忙啊
#3
kevinxu06382011-12-09 14:12
什么情况 这论坛现在这么不热情了啊 斑竹之类的都不帮忙了啊
#4
chinasj2011-12-09 18:21
要检查一下数据表中的字段类型
#5
kevinxu06382011-12-09 20:28
回复 4楼 chinasj
都是文本型  要是有字段为空 那也就是ID 自动编号的啊 不需要啊
#6
jfei2011-12-10 11:35
<% Option Explicit %>
    <%
    Dim db
    Set db=Server.CreateObject("ADODB.Connection")
    db.Open "table"
    dim strSql,strlsbh,strcr,strtime,strywlb,strtdh,strhd,strzl,strtj,strrksl,strcksl,strysch,strbz
strlsbh=request.form("lsbh")  /*获取请求内容*/
strcr=request.form("cr")
strtime=request.form("time")
strywlb=request.form("ywlb")
strtdh=request.form("tdh")
strhd=request.form("hd")
strzl=request.form("zl")
strtj=request.form("tj")
strrksl=request.form("rksl")
strcksl=request.form("cksl")
strysch=request.form("ysch")
strbz=request.form("bz")

strsql="insert into  2011 (lsbh,cr,time,ywlb,tdh,hd,zl,tj,rksl,cksl,ysch,bz) values

('"&strlsbh&"','"&strcr&"','"&strtime&"','"&strywlb&"','"&strtdh&"','"&strhd&"','"&strzl&"','"&strtj&"','"&strrksl&"','"&strcksl&"','"&strysch&"','"&strbz&"'

)"
    db.Execute(strSql)  
Response.Redirect "add.asp"
%>
有没有2011这个表吗

Dim db;//声明db
Set db;//db赋值
db.Open "table"//以table的形式打开
dim  strSql,strlsbh,strtime,strywlb,strtdh,strhd,strzl,strtj,strrksl,strcksl,strych,strbz
分隔符正确吗?
#7
kevinxu06382011-12-10 21:25
回复 6楼 jfei
你说的这些我都是对的 符号都是英文下的 有2011
#8
hu9jj2011-12-11 10:38
建议将strsql串简化,运行通过后再逐个字段添加,以便找到引起出错的原因。
#9
kevinxu06382011-12-12 19:37
回复 8楼 hu9jj
找到了 是time字段 这是保留字段 默认就是时间的 我用的文本不行 现在把这个换了  而且我文件和所在文件夹没写入权限 NTFS的盘
1