Help with recordset.bof / eof

Discussion in 'Javascript' started by Yaara Mac, Feb 5, 2008.

  1. Yaara Mac

    Yaara Mac Guest

    Hi all,

    I need some help with using recordset.bof / oef.

    I'm using HTML file to display XML records page by page.

    I need to disable the moveNext button once it reaches the end of the
    file but it seems to occur one page too late.

    that's the function I used for the onclick of the button:

    function Next()
    {


    if (!mydata.recordset.EOF)
    {
    mydata.recordset.moveNext();
    }
    else
    {
    btn_next.disabled = true;
    }

    }


    Any ideas?
     
    Yaara Mac, Feb 5, 2008
    #1
    1. Advertisements

  2. Yaara Mac

    Jim Aikin Guest

    I'm strictly a hobbyist programmer, and this answer is quite likely
    wrong -- but have you tried this:

    function Next()
    {
    if (!mydata.recordset.EOF)
    {
    mydata.recordset.moveNext();
    if (mydata.recordset.EOF) btn_next.disabled = true;
    }
    else
    {
    btn_next.disabled = true;
    }
    }

    Assuming that moveNext increments the file pointer, that might work.

    --Jim Aikin
     
    Jim Aikin, Feb 5, 2008
    #2
    1. Advertisements

  3. Yaara Mac

    Yaara Mac Guest

    Hey, thanks! it's pretty close..

    Now I've noticed that before changin the code it was two pages late -
    now it's only one page late.

    Somehow it doesn't detect that last record as the last one.
     
    Yaara Mac, Feb 5, 2008
    #3
  4. Yaara Mac

    Evertjan. Guest

    Jim Aikin wrote on 05 feb 2008 in comp.lang.javascript:
    [Please do not toppost on usenet]
    shorter:

    function Next() {
    if (!mydata.recordset.EOF)
    mydata.recordset.moveNext();
    if (mydata.recordset.EOF)
    btn_next.disabled = true;
    };

    or even:

    function Next() {
    if (!mydata.recordset.EOF)
    mydata.recordset.moveNext();
    btn_next.disabled = mydata.recordset.EOF;
    };
     
    Evertjan., Feb 5, 2008
    #4
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.