Solved

Classic ASP Date time build

Posted on 2013-11-19
8
427 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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

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

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

630 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