Microsoft Vbscript Compilation Error 800a0415
Forum Other Programming Scripting - Client Side Can anybody give me further details about the message:"Expected literal constant" If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register or Login before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 2 of 2 Thread: Can anybody give me further details about the message:"Expected literal constant" Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode January 26th, 2003,06:27 PM #1 mpoincare View Profile View Forum Posts Member Join Date Nov 2002 Posts 90 Can anybody give me further details about the message:"Expected literal constant" I am trying to add a new record in a ms access database located in the following physical path: C\Inetpub\wwwroot\plea\data\project.mdb on a windows2000 server. I a using the following ASP code in order to do that: <% Dim conn, sConnection Const DB_CONNECTIONSTRING = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=" & Server.MapPath("project.mdb") & ";" Session.TimeOut=60 Set conn = Server.CreateObject("ADODB.Connection") conn.Open(DB_CONNECTIONSTRING) %> But the browser keeps displaying this error message: Technical Information (for support personnel) Error Type: Microsoft VBScript compilation (0x800A0415) Expected literal constant /Plea/Data/AppLogic.asp, line 6, column 54 & "Data Source=" & Server.MapPath("project.mdb") & ";" -----------------------------------------------------^ Can somebody explain me what the statement:"Expected literal constant" means in a context like that and what can be done to fix it. I also tried to use the Physical path to reach the database ( C\Inetpub\wwwroot\plea\data\project.mdb) and I still get the same message. I am using IE4 (or IE5) Reply With Quote January 27th, 2003,04:49 AM #2 Thread1 View Profile View Forum Posts Elite Member Join Date Jan 2003 Location 7,107 Islands Posts 2,487 Check out on how you declare your constant variable! Constant variable should contain only literal string, no variables no objects no function calls etc. Try this : Dim conn, sConnection Dim DB_CONNECTIONSTRING DB_CONNECTIONSTRING = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=" & Server.MapPath("project.mdb") & ";" Busy Reply With Quote Quick Navigation Scripting - Client Si
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > constants Want to Advertise Here? Solved constants Posted on 2000-01-20 ASP 1 Verified Solution 2 Comments 1,294 Views Last Modified: 2012-08-13 Hi, Im using this code in my asp file <% cosnt base_Number = 0 const base_Number_One = base_Number + 1 const base_Number_Two = base_Number + 2 %> http://forums.codeguru.com/showthread.php?228191-Can-anybody-give-me-further-details-about-the-message-quot-Expected-literal-constant-quot When I run this code I get the following error message. Microsoft VBScript compilation error '800a0415' Expected literal constant /myProject/MyAsp.inc, line 9 const base_Number_Two = base_Number + 2 ---------------------------------------^ Any Idea why? Suden 0 Question by:suden Facebook Twitter LinkedIn Google LVL 5 Best Solution bymayhew From MSDN (VBScript-Const), (note the last sentence) "You can't use variables, user-defined functions, or intrinsic VBScript functions (such as Chr) in constant declarations. By definition, they can't https://www.experts-exchange.com/questions/10262919/constants.html Go to Solution 2 Comments LVL 5 Overall: Level 5 ASP 1 Message Accepted Solution by:mayhew2000-01-20 From MSDN (VBScript-Const), (note the last sentence) "You can't use variables, user-defined functions, or intrinsic VBScript functions (such as Chr) in constant declarations. By definition, they can't be constants. You also can't create a constant from any expression that involves an operator, that is, only simple constants are allowed. " 0 LVL 1 Overall: Level 1 Message Author Comment by:suden2000-01-20 Thanks Suden 0 Write Comment First Name Please enter a first name Last Name Please enter a last name Email We will never share this with anyone. Comment Submit Your Comment By clicking you are agreeing to Experts Exchange's Terms of Use. Featured Post What Should I Do With This Threat Intelligence? Promoted by Recorded Future Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence. CONTINUE READING Suggested Solutions Title # Comments Views Activity Refresh div using javascript. No meta refresh 17 126 206d two-way Authentication ASP 3 61 114d An ASP query I cannot work out... 2 37 98d Highlight a word from some text 16 33 79d ASP Classic - Using Parameterized Queries Article by: Wayne I have helped a lot of peopl
To correct this error Do not use microsoft vbscript compilation expressions when declaring constants. See AlsoReferenceConst Statement (VBScript)ConceptsConstants (VBScript)VBScript Constants
Need Help about VBScript? Download VbsEdit! This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit.The evaluation version never expires. Home Copyright © 2001-2016 AdersoftRemember Me? Register Lost Password? facebook google twitter rss Free SEO Tools Advanced Search Forum Programming ASP Development Here Thread: Expected literal constant error Share This Thread Tweet This + 1 this Post To Linkedin Subscribe to this Thread Subscribe to This Thread February 15th, 2006,04:37 AM #1 smallboy Learns, Forgets, Asks Join Date Sep 2005 Location Surrey, UK Posts 710 Rep Power 21 Expected literal constant error I have this code snippet Code: Dim g_Key Const g_CryptThis = "Now is the time for all good men to come to the aid of their country." Const g_KeyLocation = server.mappath & "\key.txt" g_Key = mid(ReadKeyFromFile(g_KeyLocation),1,Len(g_CryptThis)) and am getting this error Microsoft VBScript compilation error '800a0415' Expected literal constant line 5 being const g_keylocation..... I want to use the server.mappath variable. Cheers, Smalls. Ps: if it seems I am asking simple questions it is for 2 reasons, 1. I have no formal training in ASP & 2. I have had 2 strokes in 6 months so my memory isnt what is used to be Faq Reply With Quote February 15th, 2006,04:41 AM #2 Guddu Contributing User Join Date Jul 2005 Location Oxford UK Posts 3,897 Rep Power 991 try this Code: Const g_KeyLocation = server.mappath("\key.txt") Nothing is Impossible bcoz IMPOSSIBLE itself says.. I M POSSIBLE........................ Be cool !!!!!!!! Faq Reply With Quote February 15th, 2006,04:48 AM #3 smallboy Learns, Forgets, Asks Join Date Sep 2005 Location Surrey, UK Posts 710 Rep Power 21 Originally Posted by Guddu try this Code: Const g_KeyLocation = server.mappath("\key.txt") Hi M8, made the change and get this error... Code: Microsoft VBScript compilation error '800a0415' Expected literal constant /markj/wfksecure/scramble.inc, line 6 Const g_KeyLocation = server.mappath("\key.txt") -----------------------------------