Solved

Classic ASP Date time build

Posted on 2013-11-19
8
410 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
  • 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
 
LVL 9

Expert Comment

by:QuinnDex
ID: 39660481
yes it should and the line shouldn't end in &
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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 500 total points
ID: 39660530
Plus its not good practice to remove all spaces.
"&HelAtimedatef&"',103)

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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now