Passing variables with an IF statement in SQL

Results 1 to 2 of 2

Thread: Passing variables with an IF statement in SQL

  1. #1
    Join Date
    Dec 1969

    Default Passing variables with an IF statement in SQL

    Hi there-<BR>Kinda new to all this. I&#039;ve got an ASP site that is interacting on a display-only basis with MSSQL 2000.<BR><BR>The way it is set up is as follows: there is a main search page, that allows for searching by client name. After performing the search, all the products that the client has are displayed as hyperlinks that link to a page that has information on that particular product. These product pages are also intended to be searchable by client. The "Client" field is non-unique. However, there is a unique ID field. I need to be able to pass that unique ID from the main page to the sub-page while still retaining the ability to search by the non-unique client name.<BR><BR>I have worked out how to pass the ID number from the client page to the product page. I can&#039;t, however, work out how to make the product pages capable of both receiving this ID number and still be able to search by a different field.<BR><BR>I beleive that an IF statement would probably work, something along the lines of "if ?=Client is null, then search by ?=ID" but I can figure out syntax.<BR><BR>any help would be greatly appreciated

  2. #2
    Join Date
    Dec 1969

    Default RE: Passing variables with an IF statement in SQL

    are you passing both fields in the querystring?<BR><BR>page.asp?Client=&ID=<BR><BR>If Trim(Request("Client")) = "" Then<BR> ... SEARCH BY Trim(Request("ID")) ...<BR>End If<BR><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