Search Function

Results 1 to 3 of 3

Thread: Search Function

  1. #1
    Paul Diana Guest

    Default Search Function

    Can anyone help me with a code that can seach a database for a specific string? I don&#039t have a starter code yet but if you can provide me with one I would appreciated very much<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Search Function

    select part_no, vendor_part, vendor, descript1, media, cpu, dealer as Price FROM CATALOG where part_no =&#039" & strValue & "&#039"<BR><BR>This line pulls a line from my db where the part number = a value passed to it by a form. Hope this helps.

  3. #3
    David Highlander Guest

    Default Try this:

    On one page you need the forms you are going to search by. So if they were text boxes they would read:<BR><BR>First Name:<BR><BR>&#060;input NAME="firstname" SIZE="50" MAXLENGTH="100" &#062;<BR><BR>Last Name:<BR><BR>&#060;input NAME="company" SIZE="50" MAXLENGTH="100"&#062;<BR><BR>Then you need to pass these values to the display page. The display page will look like so:<BR><BR>DSN = Userdatabase<BR>TABLE = names<BR>FIELDS = firstname, lastname<BR><BR><BR> &#060;%<BR> Dim Sqlstring<BR> Sqlstring = "SELECT firstname, lastname FROM names WHERE firstname=&#039" & Request.Form.Item("firstname") & "&#039 OR lastname=&#039" & Request.Form.Item("lastname") & "&#039"<BR><BR> Dim conn<BR> Dim UserRecordset<BR> Set conn = Server.CreateObject("ADODB.Connection")<BR> ("Userdatabase")<BR> Set UserRecordset = Server.CreateObject("ADODB.Recordset")<BR> UserRecordset.Open Sqlstring, conn<BR> <BR> Set objfirstname = UserRecordset("firstname")<BR> Set objlastname = UserRecordset("lastname")<BR> If UserRecordset.EOF Then<BR> %&#062;<BR><BR>Then you write out your results:<BR><BR>&#060;%=objfirstname%&#062;<BR>&#0 60;%=objlastname%&#062;

Posting Permissions

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