1

可以理解,这是一个普遍的错误。但是,浏览其他内容并没有为我提供太多有用的信息。

这是代码:

<%@ Language=VBScript %>
<%
' variable listing and usage
DIM conx ' connection object to the server
DIM comd ' instance of a command object
DIM bookingsql ' string variable to hold the SQL commands
DIM itemsAdded ' numeric var to hold num records added to table (1 or 0)
DIM dbpath  ' path to the database file

set conx=server.CreateObject("ADODB.connection")

conx.Provider="Microsoft.ACE.OLEDB.12.0"
dbpath = Server.Mappath("database/thrus.mdb")
conx.Mode = 3 ' adModeReadWrite
conx.Open dbpath ' open the database

set comd=server.CreateObject("ADODB.Command")
comd.ActiveConnection=conx

bookingsql="INSERT INTO booking (boo_UserID, boo_PerID, boo_SeaID) VALUES('" &_
session("usr_ID") & "','" & _
request("performanceid") & "','" & _
request("firstSeat")& "')" 

comd.CommandText=bookingsql 
comd.Execute itemsAdded

conx.close
set conx=nothing
set comd=nothing
%>

代码也在这里

我收到错误:

Microsoft Access Database Engine error '80040e07'

Data type mismatch in criteria expression.

/STUDENT/s0191958/PART2/bookprocess.asp, line 33

现在第 33 行很简单

comd.Execute itemsAdded

所以我相信它可能与 items added 命令有关,但实际上与命令无关。如果您需要更多信息,请告诉我我可以如何帮助您 - 帮助我:D

谢谢

4

1 回答 1

1

该错误表明添加到至少一列的数据类型与该列可接受的数据类型不匹配。

SQL INSERT 语句将数据值作为字符串数据提交,该数据应该是一组三个数字吗?如果是,则尝试更改为以下内容,这会从值中删除单引号:

bookingsql="INSERT INTO booking (boo_UserID, boo_PerID, boo_SeaID) VALUES(" &_
session("usr_ID") & "," & _
request("performanceid") & "," & _
request("firstSeat")& ")" 
于 2013-01-06T03:58:43.973 回答