Asp classic ASP类中缺少运算符

Asp classic ASP类中缺少运算符,asp-classic,Asp Classic,我试图将我的pos_日期、pos_时间等变量添加到我的数据库中,并在下面显示错误,尽管它显示了第61行,但我认为这是SQL问题,而不是第61行 <%@ Language=VBScript %> <% ' make VB declare all variables option explicit ' variable listing and usage DIM conx ' connection object to the server DIM comd ' instance

我试图将我的pos_日期、pos_时间等变量添加到我的数据库中,并在下面显示错误,尽管它显示了第61行,但我认为这是SQL问题,而不是第61行

<%@ Language=VBScript %>

<%
' make VB declare all variables
option explicit

' variable listing and usage
DIM conx ' connection object to the server
DIM comd ' instance of a command object
DIM sql_comd ' 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

' create an ado (activeX data object) connection on the server...
set conx=server.CreateObject("ADODB.connection")

' Create a "DSN-less" connection to database using OLEDB
dbpath = Server.Mappath("db/unibookv2.mdb")
conx.Provider="Microsoft.Ace.OLEDB.12.0"
conx.Mode = 3 ' adModeReadWrite
conx.Open dbpath ' open the database

' instantiate a command object to create a new record via SQL
set comd=server.CreateObject("ADODB.Command")
' tell the command object which is the active connection
comd.ActiveConnection=conx


' #######################################################
' -----------------------------------------------------------------------
' The following code checks for errors in user input not picked up by
' any client side JavaScript and can be omitted initially
' -----------------------------------------------------------------------
DIM pos_DATE 
DIM pos_TIME 

pos_DATE = request ("DATE")
pos_TIME = request ("TIME")

if NOT ISDate(pos_TIME) Then
    pos_TIME = "00:00:00"
end if


if NOT ISDate(pos_DATE) Then
    pos_DATE = "01/01/00"
end if


sql_comd="INSERT INTO post (pos_USERID, pos_caption, pos_content, pos_DATE, pos_TIME) VALUES('" &_
request("pos_USERID") & "','" & _
request("pos_caption") & "','" & _
request("pos_content") & "','" & _
pos_DATE & "'," & _
pos_TIME & ")"



comd.CommandText=sql_comd  ' this is the SQL Insert command sent to the DBMS
' This line executes the SQL against the DBMS (in this case "MS Access") using the ADO command object
comd.Execute itemsAdded ' use the execute method of the command object, return number of items added (if any), errors in your SQL will show as being in THIS line not the SQL line..!
%>

<h2>ASP - Demo of Add Record to Database table using SQL </h2>

    <!-- draw an HTML separator line -->
    <hr align="left" width="758" /><br />
    <p>&nbsp;</p>

    <%
    ' this is where we use the 'itemsAdded' variable
    If itemsAdded=1 Then
        ' message to confirm 1 added record
        Response.Write "<h3>New record saved successfully to 'testtable'</h3>"
    Else
        ' message in red (oops no CSS!) to alert user of an error
        Response.Write "<h3 style='color:red;'>ERROR - record NOT saved'</h3>"
    End if
    %>

' processing done therefore tidy up... close and destroy any objects used to conserve server resources
conx.close
set conx=nothing
set comd=nothing


%>

pos_TIME是字符串吗?如果是这样,则在sql comd末尾的pos_时间附近缺少“”

Microsoft Access Database Engine error '80040e14'

Syntax error (missing operator) in query expression '00:00:00'.

/student/s0190204/WIP/addpost.asp, line 61