HELP w/displaying records based on criteria

Results 1 to 3 of 3

Thread: HELP w/displaying records based on criteria

  1. #1
    David White Guest

    Default HELP w/displaying records based on criteria

    I&#039ve checked the FAQs, and searched the tutorials as best I could, to no avail. The task I need to accomplish is this:<BR>I have an HTML page with a form on it with one dropdown list, from which the user can choose to list "All" landscape companies in the DB, OR landscape companies based on a specific county. The data source is an Access DB. I can successfully get the ASP page to display all records, but it doesn&#039t seem to be using the form&#039s criteria. Also, if no records are found, I&#039d like to be able to return a simple message reflecting that fact. This seems to be a simple problem, with a simple resolution, but it&#039s beyond me at this point. ANY help is very much appreciated... thank you.<BR><BR>David White<BR>

  2. #2
    FED Guest

    Default RE: HELP w/displaying records based on criteria

    The simplest way to get past your second problem is to use the recordset.EOF to determine if the query returned any records at all.<BR>If YOURRECORDSET.EOF Then<BR>Statements....<BR>Else<BR>Statements....<B R>End If<BR><BR>On your first problem : <BR>Are you successfully retreaving the criteria from user?<BR>How does your SQL-Statement look like?

  3. #3
    ifti Guest

    Default RE: HELP w/displaying records based on criteria

    hi fella<BR><BR>What you need to do is read from the form the country that the user wants and then match every single record inyou database to see if a company exists in that country when it does call a subroutine that will display the info. The best way iv&#039e found of showing if there is no record is if you put a boolean in the script and sets it defult value at FALSE and if a record is found set it to True if it is still false at the end of the record sweep write a code that says there was no record found.<BR><BR>iv&#039e put some code at the bottom i don&#039t know if it will help!<BR><BR>e.g<BR><BR>&#039setting the booleon to a value to be compared with<BR>blnVariant = FALSE<BR><BR>Do While Not database.EOF <BR> CountryForm = Request.Form("country") &#039info from the form<BR> CountryDbase = (rsdatabase("country"))&#039from the database<BR> If CountryForm = CountryDbaseThen<BR> Call Buildpage<BR> blnVariant = TRUE<BR> End If <BR> database.MoveNext<BR> <BR> <BR>Loop <BR> <BR>If blnVariant = TRUE Then <BR>Response.Write "Sorry no records were found" <BR>End if<BR><BR>&#060;%<BR>Sub BuildPage<BR><BR> &#039 put all info that displays the page in here<BR>End Sub<BR>%&#062;<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