Results 1 to 4 of 4

Thread: Fields including certain text

  1. #1
    Join Date
    Feb 2005
    Posts
    81
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Fields including certain text

    I have a field which contains comments, this will always include either ON HIRE or OFF HIRE

    How can I filter the fields based on if it includes OFF HIRE or not

    Thanks

  2. #2
    Join Date
    Feb 2004
    Posts
    4,901
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    Quote Originally Posted by s80wkr
    I have a field which contains comments, this will always include either ON HIRE or OFF HIRE

    How can I filter the fields based on if it includes OFF HIRE or not

    Thanks
    Create a boolean field in your database table (aka bool, aka bit) - this value should then be 1 or 0, true or false.

    In your code (ASP) you would simply use:

    Code:
    If CBool(rsMyRecordset("HireStatus")) Then
     ' On Hire
    Else
     ' Off Hire
    End If
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

  3. #3
    Join Date
    Jun 2005
    Posts
    1,081
    Thanks
    4
    Thanked 15 Times in 15 Posts

    Default

    You'd be better off doing the filtering when getting records from the database:

    Code:
    SELECT col1, col2, HireStatus, col4 FROM tbl WHERE HireStatus = FALSE
    Note: You need to replace colX to be the names of the columns you want to get, tbl to be the name of the table. You may also need to change FALSE to 0 depending on the database platform.

    I listed the columns this way because it provides better performance than using the wildcard '*' to select all columns.

  4. #4
    Join Date
    Feb 2004
    Posts
    4,901
    Thanks
    2
    Thanked 134 Times in 113 Posts

    Default

    Quote Originally Posted by Sol
    You'd be better off doing the filtering when getting records from the database:

    Code:
    SELECT col1, col2, HireStatus, col4 FROM tbl WHERE HireStatus = FALSE
    I assumed that would go without saying, I just gave an example of how to do it in code, when you wish to show the hire status, but not filter the results by it.
    Warren Ashcroft
    Red Fox UK Limited - Pioneers in Internet Technology
    http://www.redfoxuk.com
    w.ashcroft [at] redfoxuk.com

    NOTE: Forum Private Messaging should not be used to contact staff with support queries.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Full Text Service in SQL Server
    By thinkingaustralia in forum Sales and Service Feature Enquiries
    Replies: 4
    Last Post: 2nd May 2006, 12:06 PM

Bookmarks

Posting Permissions

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