Advertisement

12.10.2004 at 11:05PM PST, ID: 21238812
[x]
Attachment Details

SQL INSERT DATE ERROR on ASP page

Asked by maduko in Microsoft Access Database

Tags: insert, date, sql, asp

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")&request("StartM")&request("StartD"))
EndDate = trim(request("EndY")&request("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("Description"),"'","''")
Remote = Request.ServerVariables("REMOTE_HOST")

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data 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
[+][-]12.10.2004 at 11:10PM PST, ID: 12798731

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.10.2004 at 11:16PM PST, ID: 12798741

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.10.2004 at 11:24PM PST, ID: 12798755

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Access Database
Tags: insert, date, sql, asp
Sign Up Now!
Solution Provided By: alanwarren
Participating Experts: 4
Solution Grade: A
 
 
[+][-]12.10.2004 at 11:26PM PST, ID: 12798759

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 02:02AM PST, ID: 12799030

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 02:04AM PST, ID: 12799038

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 06:08AM PST, ID: 12799668

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 06:20AM PST, ID: 12799694

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 06:29AM PST, ID: 12799714

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 06:36AM PST, ID: 12799733

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 06:45AM PST, ID: 12799757

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.11.2004 at 08:59AM PST, ID: 12800150

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.20.2005 at 04:43AM PDT, ID: 14919112

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.29.2005 at 11:48AM PDT, ID: 14986683

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32