?
Solved

Classic ASP Date time build

Posted on 2013-11-19
8
Medium Priority
?
429 Views
Last Modified: 2013-11-19
Hi Guys,

This is a basic error that I cannot see the wood for the trees.

Can anyone help:

Doutdatetimef = Request("Doutdatetime")&" "&Request("Doutdatetimeh")&":"&Request("Doutdatetimem")
HelAtimedatef = Request("HelAtimedate")&" "&Request("HelAtimedateh")&":"&Request("HelAtimedatem")
HelDtimedatef = Request("HelDtimedate")&" "&Request("HelDtimedateh")&":"&Request("HelDtimedatem")
RATimedatef = Request("RATimedate")&" "&Request("RATimedateh")&":"&Request("RATimedatem")

strSQL = strSQL + " Insert [tblJob-Cal-flight-book] (Job_ID, DFlight_No, Depart, DTimedate, Arive, ATimedate, RDepart, RTimedate, RArive, RATimedate, RFlight_No, Eng_ID, Type, Conformation_No, Airline) VALUES ('"&JobIDa&"', '"&Request("DFlight_No")&"', '"&Request("Depart")&"',  CONVERT(DATETIME,'"&Doutdatetimef&"',103), '"&Request("Arrival")&"', CONVERT(DATETIME,'"&Doutdatetimef&"',103), '"&Request("RDepart")&"', CONVERT(DATETIME,'"&HelDtimedatef&"',103), '"&Request("RArive")&"', CONVERT(DATETIME,'"&RATimedatef&"',103), '"&Request("RFlight_No")&"', '"&Request("Eng_ID")&"', 'Flight', '"&Request("conformation_no")&"', '"&Request("airline")&"' )"

Open in new window



Microsoft VBScript compilation error '800a0401'

Expected end of statement

/Job_MGT_SYS/inc/Book_Job_flight.asp, line 38
strSQL = strSQL + " Insert [tblJob-Cal-flight-book] (Job_ID, DFlight_No, Depart, DTimedate, Arive, ATimedate, RDepart, RTimedate, RArive, RATimedate, RFlight_No, Eng_ID, Type, Conformation_No, Airline) VALUES ('"&JobIDa&"', '"&Request("DFlight_No")&"', '"&Request("Depart")&"',  CONVERT(DATETIME,'"&HelAtimedatef&"',103), '"&Request("Arrival")&"', CONVERT(DATETIME,'"&Doutdatetimef&"',103), '"&Request("RDepart")&"', CONVERT(DATETIME,'"&HelDtimedatef&"',103), '"&Request("RArive")&"', CONVERT(DATETIME,'"&RATimedatef&"',103), '"&Request("RFlight_No")&"', '"&Request("Eng_ID")&"', 'Flight', '"&Request("conformation_no")&"', '"&Request("airline")&"' )"
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

screenshot
0
Comment
Question by:Gareth_Pointon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 

Author Comment

by:Gareth_Pointon
ID: 39660443
Sorry the end of the ===== is

strSQL = strSQL + " Insert [tblJob-Cal-flight-book] (Job_ID, DFlight_No, Depart, DTimedate, Arive, ATimedate, RDepart, RTimedate, RArive, RATimedate, RFlight_No, Eng_ID, Type, Conformation_No, Airline) VALUES ('"&JobIDa&"', '"&Request("DFlight_No")&"', '"&Request("Depart")&"',  CONVERT(DATETIME,'"&
0
 
LVL 9

Expert Comment

by:QuinnDex
ID: 39660471
that line ends in & what comes next??
0
 
LVL 58

Expert Comment

by:Gary
ID: 39660476
strSQL = strSQL +

+ ???

Shouldn't it be &
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 9

Expert Comment

by:QuinnDex
ID: 39660481
yes it should and the line shouldn't end in &
0
 

Author Comment

by:Gareth_Pointon
ID: 39660501
No the strSQL = strSQL + is right as thats adding strSQL + strSQL

and the line ending in the & is so show where the message is indicating the error. Please see the first code snip.
Doutdatetimef = Request("Doutdatetime")&" "&Request("Doutdatetimeh")&":"&Request("Doutdatetimem")
HelAtimedatef = Request("HelAtimedate")&" "&Request("HelAtimedateh")&":"&Request("HelAtimedatem")
HelDtimedatef = Request("HelDtimedate")&" "&Request("HelDtimedateh")&":"&Request("HelDtimedatem")
RATimedatef = Request("RATimedate")&" "&Request("RATimedateh")&":"&Request("RATimedatem")

strSQL = strSQL + " Insert [tblJob-Cal-flight-book] (Job_ID, DFlight_No, Depart, DTimedate, Arive, ATimedate, RDepart, RTimedate, RArive, RATimedate, RFlight_No, Eng_ID, Type, Conformation_No, Airline) VALUES ('"&JobIDa&"', '"&Request("DFlight_No")&"', '"&Request("Depart")&"',  CONVERT(DATETIME,'"&Doutdatetimef&"',103), '"&Request("Arrival")&"', CONVERT(DATETIME,'"&Doutdatetimef&"',103), '"&Request("RDepart")&"', CONVERT(DATETIME,'"&HelDtimedatef&"',103), '"&Request("RArive")&"', CONVERT(DATETIME,'"&RATimedatef&"',103), '"&Request("RFlight_No")&"', '"&Request("Eng_ID")&"', 'Flight', '"&Request("conformation_no")&"', '"&Request("airline")&"' )"

Open in new window

0
 
LVL 9

Expert Comment

by:QuinnDex
ID: 39660511
no it should be &, it may be working in your query but if your vars were numbers it would add them up
0
 
LVL 58

Expert Comment

by:Gary
ID: 39660515
Well its years since I have used classic ASP, but what I remember is that '&' is for string concatenation. The same way you are using it in the rest of the string
+ is for mathematical addition
0
 
LVL 58

Accepted Solution

by:
Gary earned 1500 total points
ID: 39660530
Plus its not good practice to remove all spaces.
"&HelAtimedatef&"',103)

Should be
" & HelAtimedatef & "',103)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question