I have been wrestling with a data type mismatch problem for several days. The ASP page is submitting to an Access 2000 database. The table has two date fields- StartDate and EndDate. No matter how I change the syntax of the SQL Insert statement I either get a mismatch or # signs are passed in the statement.
My current code is below. The error I recieve is:
Microsoft JET Database Engine error '80040e07'
Syntax error in date in query expression '#20040414#'.
/calendar/event_add.asp, line 61
Current code on page:
Dim Conn
Dim SqlTemp
sEvent = request("Event")
StartDate = trim(request("StartY")&req
uest("Star
tM")&reque
st("StartD
"))
EndDate = trim(request("EndY")&reque
st("EndM")
&request("
EndD"))
Location = request("Location")
State = request("State")
Country = request("Country")
rType = request("Type")
ContactName = request("ContactName")
ContactEmail = request("ContactEmail")
ContactPhone = request("ContactPhone")
ContactFax = request("ContactFax")
WebInfo = request("WebInfo")
Description = Replace(Request.Form("Desc
ription"),
"'","''")
Remote = Request.ServerVariables("R
EMOTE_HOST
")
Set Conn = Server.CreateObject("ADODB
.Connectio
n")
Conn.connectionstring = "Provider=Microsoft.Jet.OL
EDB.4.0;Da
ta Source=" & Server.MapPath("\fpdb\p2r.
mdb")& ";"
Conn.Open
SQLTemp = "INSERT INTO events (Remote, [Event], StartDate, EndDate, Location, State, Country, [Type], ContactName, ContactEmail, ContactPhone, ContactFax, WebInfo, Description, [Timestamp]) VALUES ('" & Remote & "', '"& sEvent &"', #" & StartDate & "#, #" & EndDate & "#, '" & Location & "', '" & State & "', '" & Country & "', '" & rType & "', '" & ContactName & "', '" & ContactEmail & "', '" & ContactPhone & "', '" & ContactFax & "', '" & WebInfo & "', '" & Description & "', '" & now() & "')"
Conn.execute(SQLTemp)
Start Free Trial