Another recordset question

Discussion in 'ASP General' started by Rob Meade, Mar 1, 2004.

  1. Rob Meade

    Rob Meade Guest

    Lo all,

    I have a local recordset which is not linked to a database.

    Some of the fields in this recordset contain html tags.

    I have a function which is called when I'm calculating my relevance for
    search results which gets the row from the recordset, strips out the html
    tags, then does its magic to produce the 'relevance' for that row.

    My problem is that when the search is carried out initially, it obviously
    matches against the html aswell, after my relevance is calculated a row
    could exist in my recordset with a 0 for relevance but its still in the
    recordset because it was found initially.

    I figure I have two options - before I dump the results to the page I could
    either iterate through the recordset again, if there are any results with a
    0 relevance then delete them from the recordset, or, have an if..then to see
    if the relevance for that row is 0 and then NOT display it to the page.

    Question :

    Is it better to remove the row from the recordset then just display all -
    rather than using the if...then or is it better to use the if...then and not
    have to iterate through the recordset to remove all the 0 relevance rows..

    Also - if I am to delete the rows from the recordset - anyone got a small
    snippet of code to do that?

    I'm using stuff like :

    RS.AddNew
    RS.Update

    for this local recordset - not sure how to drop a row like this?

    Any help is appreciated,

    Regards

    Rob
    Rob Meade, Mar 1, 2004
    #1
    1. Advertising

  2. Rob Meade

    Bob Barrows Guest

    Rob Meade wrote:
    > Lo all,
    >
    > I have a local recordset which is not linked to a database.
    >
    > Some of the fields in this recordset contain html tags.
    >
    > I have a function which is called when I'm calculating my relevance
    > for search results which gets the row from the recordset, strips out
    > the html tags, then does its magic to produce the 'relevance' for
    > that row.
    >
    > My problem is that when the search is carried out initially, it
    > obviously matches against the html aswell, after my relevance is
    > calculated a row could exist in my recordset with a 0 for relevance
    > but its still in the recordset because it was found initially.
    >
    > I figure I have two options - before I dump the results to the page I
    > could either iterate through the recordset again, if there are any
    > results with a 0 relevance then delete them from the recordset, or,
    > have an if..then to see if the relevance for that row is 0 and then
    > NOT display it to the page.
    >
    > Question :
    >
    > Is it better to remove the row from the recordset then just display
    > all - rather than using the if...then or is it better to use the
    > if...then and not have to iterate through the recordset to remove all
    > the 0 relevance rows..



    Can't answer this without testing ...

    >
    > Also - if I am to delete the rows from the recordset - anyone got a
    > small snippet of code to do that?
    >
    > I'm using stuff like :
    >
    > RS.AddNew
    > RS.Update
    >
    > for this local recordset - not sure how to drop a row like this?


    RS.Delete


    Bob Barrows


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows, Mar 1, 2004
    #2
    1. Advertising

  3. Rob Meade

    Rob Meade Guest

    "Bob Barrows" wrote ...

    > Can't answer this without testing ...


    Hi Bob

    No worries, I *personally* think that the If..then would be better,
    otherwise I have to iterate through the entire recordset again - admittedly
    only the once - but it could be huge, the If...Then is already in the main
    iteration - so would make more sense....will probably go with this method
    for now...

    > RS.Delete


    doh! "Does exactly what it says on the tin" ... :eek:)

    Cheers

    Rob
    Rob Meade, Mar 1, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gian Paolo Clarici
    Replies:
    0
    Views:
    773
    Gian Paolo Clarici
    Jul 21, 2004
  2. Hung Huynh
    Replies:
    8
    Views:
    287
    Bob Barrows
    Sep 24, 2003
  3. Maria Kovacs

    Recordset Display Question

    Maria Kovacs, Jan 27, 2004, in forum: ASP General
    Replies:
    8
    Views:
    131
    Bob Lehmann
    Jan 29, 2004
  4. Rob Meade

    Recordset Question

    Rob Meade, Feb 9, 2004, in forum: ASP General
    Replies:
    5
    Views:
    163
    Rob Meade
    Feb 10, 2004
  5. Oscar
    Replies:
    27
    Views:
    469
    Mark J. McGinty
    Jun 1, 2005
Loading...

Share This Page