ASP/VBScript concatenation problem

Results 1 to 3 of 3

Thread: ASP/VBScript concatenation problem

  1. #1
    Join Date
    Dec 1969

    Default ASP/VBScript concatenation problem

    Hi, <BR> I have a peculiar problem. I am trying to retrieve a recordset with the following statement:<BR><BR>set objRS = objConn.Execute("SELECT No_ FROM Delivery_Order WHERE (Available_Date =" & strDATE & ")")<BR><BR>where objRS is the recordset. However, this gives an error:<BR><BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)<BR>[Navision Software a/s][Navision Financials ODBC Driver]Expected lexical element not found: )<BR><BR>I think ASP/VBScript is not taking note of the existing ) within double-quotes. I have to use the () bcos of the native database datatypes. Any ideas on how to make ASP/VBScript add the ) there? Please help.<BR> Thanks!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP/VBScript concatenation problem

    what if you had a variable that held that stuff?<BR><BR>Dim SQL<BR>SQL = "SELECT No_FROM Delivery_Order WHERE (Available_Date=" & strDATE & ")"<BR><BR>set objRS = objConn.Execute(CStr(SQL))<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Probably the usual problem...

    In *MOST* DBs, you must surround a date with &#039;...&#039;<BR><BR>So the "expected lexical element" that it didn&#039;t find is the &#039; mark.<BR><BR>Do yourself a favor: Make your code DEBUGABLE!<BR><BR><BR>SQL = "SELECT No_ FROM Delivery_Order WHERE (Available_Date =&#039;" & strDATE & "&#039; )"<BR><BR>Response.Write "DEBUG: SQL is " & SQL & "&#060;HR&#062;" & vbNewLine<BR><BR>set objRS = objConn.Execute( SQL )<BR><BR>And I guarantee this has nothing to do with the ( or ) inside the string. VBScript [hl="yellow"]can not "see" ANY characters[/hl] inside quote marks. They are all just text to it.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts