My WHERE Statement - am I close?

Results 1 to 2 of 2

Thread: My WHERE Statement - am I close?

  1. #1
    Insane programmer Guest

    Default My WHERE Statement - am I close?

    I know my Syntax isn&#039t quite right because Visual Intervdev does not recognize the word OR as part of my SQL query. But I was wondering if I was in the right direction - if so can someone continue to help me?<BR><BR>Dim Sqlstring<BR>Sqlstring = "SELECT company, companysize, duration, geography, industry FROM clientengagement" _<BR>& "WHERE company=Request.Form.Item("company") OR companysize=Request.Form.Item("companysize") OR duration=Request.Form.Item("duration") OR geography=Request.Form.Item("geopraphy") OR industry=Request.Form.Item("industry")"<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: am I close? -Yes

    You need to escape the string to put the values of your form in it; like so...<BR><BR>StrWhere = "WHERE company=&#039" & Request.Form.Item("company") & "&#039 OR Blah, blah, blah"<BR><BR>Notice the single quotes around Request.Form.Item("company")<BR><BR>StrWhere will now be equal to :<BR><BR>WHERE company=&#039WhateverTheValue&#039 OR Blah, blah, blah<BR><BR>This Should work ..<BR><BR>P.S. You don&#039t need the single quotes around numeric values<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