Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Classic ASP Date time build

Posted on 2013-11-19
8
Medium Priority
?
436 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

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.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

916 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