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

Microsoft JET Database Engine (0x80040E14) 错误

fengmnll 发布于 2010-05-11 14:55, 1539 次点击
<!--#include file="conn.asp"-->
<%  
    student_name=trim(request.Form("student_name"))
    sex=trim(request.Form("sex"))
    in_time=trim(request.Form("in_time"))
    homeplace=trim(request.Form("homeplace"))
    home_address=trim(request.Form("home_address"))
    major=trim(request.Form("major"))  
    sql="update student set  student_name='"&student_name&"',sex='"&sex&"',in_time='"&in_time&"',homeplace='"&homeplace&"',home_address='"&home_address&"',major='"&major&"' where student_id="&session("student_id")
    response.Write sql
    conn.execute(sql)
    response.write "<script language=JavaScript>" & chr(13) & "alert('您的信息修改成功!');"&"window.location.href = 'admin.asp'"&"</script>"
   'sqll="insert into system_diary(people_name) values('"&people_name&"')
%>   
错误类型
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'student_id=' 中。
/jiangjin/admin/add_student_information.asp, 第 11 行
谢谢.
16 回复
#2
fengmnll2010-05-11 14:56
哦,我的数据库中student_id是文本型
#3
afeilee2010-05-11 15:14
session("student_id")储存的为空值吧!
#4
fengmnll2010-05-11 15:35
<!--#include file="conn.asp"-->
<%  student_number=request.Form("student_number")
    student_name=request.Form("student_name")
    sex=request.Form("sex")
    in_time=request.Form("in_time")
    home_address=request.Form("home_address")
    homeplace=request.Form("homeplace")
    sql="insert into student(student_number,student_name,sex,in_time,home_address,homeplace,student_id) values('"&student_number&"','"&student_name&"','"&sex&"','"&in_time&"','"&home_address&"','"&homeplace&"','"&session("student_id")&"')"
     response.Write sql
     conn.execute(sql)
     response.write "<script language=JavaScript>" & chr(13) & "alert('添加学生信息成功.!');"&"window.location.href = 'Admin_index.asp'"&"</script>"
   'sqll="insert into system_diary(people_name) values('"&people_name&"')
%>   
错误类型:
Microsoft JET Database Engine (0x80040E07)
标准表达式中数据类型不匹配。
#5
fengmnll2010-05-11 15:36
我重新改了一下数据库,将student_id换成了自动编号,加了student_number,但是这个错误又是怎么回事呢?
谢谢
#6
afeilee2010-05-11 15:44
可能SQL语句中的字段和数据库表中的字段不一致,再仔细一下数据类型匹配不?
#7
fengmnll2010-05-11 15:57
只有本站会员才能查看附件,请 登录
我看了一下还是基本上没有什么不对啊,麻烦你在帮我看看,谢谢,麻烦你了
#8
fengmnll2010-05-11 15:58
<!--#include file="conn.asp"-->
<%
    student_id=request.Form("student_id")
    student_number=request.Form("student_number")
    student_name=request.Form("student_name")
    sex=request.Form("sex")
    in_time=request.Form("in_time")
    home_address=request.Form("home_address")
    homeplace=request.Form("homeplace")
    sql="insert into student(student_number,student_name,sex,in_time,home_address,homeplace,student_id) values('"&student_number&"','"&student_name&"','"&sex&"','"&in_time&"','"&home_address&"','"&homeplace&"','"&session("student_id")&"')"
    response.Write sql
    conn.execute(sql)
    response.write "<script language=JavaScript>" & chr(13) & "alert('添加学生信息成功.!');"&"window.location.href = 'Admin_index.asp'"&"</script>"
   
%>   
错误类型:
Microsoft JET Database Engine (0x80040E07)
标准表达式中数据类型不匹配。
/jiangjin/admin/add_student_infor.asp, 第 11 行
#9
魏兴耀2010-05-11 16:13
你你字段“student_id”是自动编号的,你SQL语句里怎么还给它赋值呢?
#10
fengmnll2010-05-11 16:24
<!--#include file="conn.asp"-->
<%
   
    student_number=request.Form("student_number")
    student_name=request.Form("student_name")
    sex=request.Form("sex")
    in_time=request.Form("in_time")
    home_address=request.Form("home_address")
    homeplace=request.Form("homeplace")
    sql="insert into student(student_number,student_name,sex,in_time,home_address,homeplace) values('"&student_number&"','"&student_name&"','"&sex&"','"&in_time&"','"&home_address&"','"&homeplace&"')"
    response.Write sql
    conn.execute(sql)
    response.write "<script language=JavaScript>" & chr(13) & "alert('添加学生信息成功.!');"&"window.location.href = 'Admin_index.asp'"&"</script>"
   
%>   把那个student_id去了还是刚才的问题
错误类型:
Microsoft JET Database Engine (0x80040E07)
标准表达式中数据类型不匹配。
/jiangjin/admin/add_student_infor.asp, 第 12 行
#11
yms1232010-05-11 17:23
session("student_id")

错误类型:
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'student_id=' 中。
/jiangjin/admin/add_student_information.asp, 第 11 行
谢谢.
搜索更
很明显,这个错误说的就是session("student_id")没有值。
#12
fengmnll2010-05-11 18:15
是在不好意思,本人才疏学浅,不知道能不能具体点,说点解决方案呢,谢谢版主
#13
gupiao1752010-05-11 18:20
ASP调试最常用的并且也最管用的方法:知道大概出错位置的时候,在其附近显示其变量是否有值输出就可以判断了!
比如版主说 session("student_id")没有值,那么你就在
sql="update student set  student_name='"&student_name&"',sex='"&sex&"',in_time='"&in_time&"',homeplace='"&homeplace&"',home_address='"&home_address&"',major='"&major&"' where student_id="&session("student_id")
    response.Write session("student_id")'看看是否有值显示,如果有值就得考虑文本类型是否正确!如果文本型的要where student_id="&session("student_id")"多加个分号,如果是自增自段的,就不必加这个分号了!
    response.end
    response.Write sql
#14
fengmnll2010-05-11 18:37
恩,谢谢,试过了,没有输出任何值,又该如何修改呢?麻烦你了.
#15
fengmnll2010-05-11 18:43
回复 13楼 gupiao175
恩,谢谢,试过了,没有输出任何值,又该如何修改呢?麻烦你了. 麻烦在问你一下,但我想知道我是否把数据添加到数据库中,应该怎么检验呢?
添加程序如下
<!--#include file="conn.asp"-->
<%
   set rs=Server.CreateObject("ADODB.Recordset")
   rs.Open "select *from Student ",conn,1,3
   rs.Addnew
   rs("student_number")=Request.Form("student_number")
   rs("student_name")=Request.Form("srudent_name")
   rs("sex")=Request.Form("sex")
   rs("in_time")=Request.Form("in_time")
   rs("homeplace")=Request.Form("homeplace")
   rs("home_address")=Request.Form("home_address")
   rs.Update
   rs.Close
   set rs=nothing
  
%>
#16
gupiao1752010-05-11 19:06
1 session("student_id")没有值,那么请找出这session("student_id")是从哪来的,从整个代码段里找;
session("student_id")=某个值,有没有类似这样的赋值代码呢?
2 直接打开数据库的Student表来看看就知道数据有没有写入了!一般在最后一行就是你添加的数据!
#17
fengmnll2010-05-11 19:22
回复 16楼 gupiao175
谢谢
1