title: Invalid Character error (ADO/ASP)
body: <p>I am trying to use a variable as the column field in the SQL. However when I run the code I get the following error: </p>
  
  <hr>
  
  <pre><code>Microsoft VBScript compilation error '800a0408'
  
  Invalid character
  
  /junk/dbresults.htm, line 25
  
  DECLARE @cat char(20)
  --------^
  </code></pre>
  
  <hr>
  
  <p>The code is below:</p>
  
  <pre><code>&lt;%
      Dim connectString, connect, conDB, con
      connectString = "Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=" &amp; Server.MapPath("data")
            src_abn = Request.QueryString("abn")
            src_cat = Request.QueryString("cat")
      set connect = Server.CreateObject("ADODB.connection")
      connect.open connectString
  
      DECLARE @cat char(20)
      DECLARE @dynamicsql char(1000)
  
      SET @cat = src_cat;
      SET @dynamicsql = "SELECT * FROM cont.csv WHERE @cat='Yes'"
  
      if src_abn = "all" then
      conDB = EXEC (@DynamicSQL)  
      else
      conDB = "SELECT * FROM cont.csv WHERE ucase(abn) LIKE ucase('%"+src_abn+"%')"   
      end if
  
      set con = connect.execute(conDB)
  %&gt;
  </code></pre>
  
  <hr>