ASP Page to query a SQL-Database

Results 1 to 2 of 2

Thread: ASP Page to query a SQL-Database

  1. #1
    Thanh Guest

    Default ASP Page to query a SQL-Database

    Hi everybody,<BR>i hope my question is at the right place!<BR>i would like to create an ASP-page whereby the user<BR>key-in a value and the ASP-page will query my SQL<BR>database and output the information.<BR>please help!<BR>thank you in advance,<BR>thanh

  2. #2
    Gumman Guest

    Default RE: ASP Page to query a SQL-Database

    I have a similar problem. I want to query my SQL db for part of words and not neccesarily the first word in a field. Besides that I also want to query for numbers that for instance starts with 18????. <BR><BR>If you just want to query the db for the first characters from a field you can build up the dbquery like this<BR><BR>strSQL = "SELECT * FROM Employee WHERE "<BR>&#039If the inputfield is filled out and if it´s the first field<BR>&#039thats filled out <BR>If (Request.Form("FirstName") &#060;&#062; "") and FirstQuestion= true Then<BR>strSQL = strSQL & "FirstName LIKE &#039" & cStr(Request.Form("FirstName")) & "%" &"&#039"<BR>&#039because now the first field is filled out<BR>FirstQuestion = False <BR>else if (Request.Form("FirstName") &#060;&#062; "") and FirstQuery= false Then<BR>&#039if this is the second field you must ad an "AND" for the <BR>&#039SQL-query<BR>strSQL = strSQL & " AND FirstName LIKE &#039" & cStr(Request.Form("FirstName")) & "%"&"&#039"<BR>end if <BR>end if<BR><BR> strSQL, DBConnection<BR><BR>Hope this will help<BR><BR>//gumman

Posting Permissions

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