Basic Questions about SQL statements

Results 1 to 2 of 2

Thread: Basic Questions about SQL statements

  1. #1
    Join Date
    Dec 1969

    Default Basic Questions about SQL statements

    I am learning SQL basics and have a questions about how to write the SELECT statement when dealing with strings.<BR><BR>For example, a statement I have is:<BR><BR>strSQL = "SELECT * FROM products WHERE Prod_name = &#039;televisions&#039;"<BR><BR>This is where the real value is televisions to be searched.<BR><BR>Now if I have a form that the user fills out that has an option for product called "prod_request", and the user chose televisions as the value among the a number of options,<BR><BR>how do you write the statement?<BR><BR>Is it the following?<BR><BR>strSQL = "SELECT * FROM products WHERE Prod_name = prod_request"<BR><BR>Apparently not, since it does not work. So, what is the proper SYNTAX, and where is a good source of information on writing WHERE clauses for string data?<BR><BR>I have 5 books and can&#039;t find the answer to this.<BR><BR>Thanks. <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Basic Questions about SQL statements

    Create a variable that contains the value of the form field<BR>productRequest = Request.Form("prod_request")<BR>strSQL = "SELECT * FROM products WHERE Prod_name = &#039;"& productRequest &"&#039;"<BR><BR>www.sqlcourse2.c om<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