Solved

Classic ASP Date time build

Posted on 2013-11-19
8
417 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Error in WHERE Clause 5 39
Entity Framework 7 30
Microsoft Azure SQL - create a read only user 2 13
When should I use a controller? 3 10
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

911 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

15 Experts available now in Live!

Get 1:1 Help Now