MS XML ADO "Fiind" method problem

Discussion in 'Javascript' started by datactrl, Sep 8, 2004.

  1. datactrl

    datactrl Guest

    Hi, all

    I've got an error such as "catastrophic failure" with the following
    staements:

    myRs=idXml.recordset;
    myRs.Find("invdate >#01/01/01#");

    The error line is pointed to Find statement.

    Jack
     
    datactrl, Sep 8, 2004
    #1
    1. Advertising

  2. datactrl

    Grant Wagner Guest

    datactrl wrote:

    > Hi, all
    >
    > I've got an error such as "catastrophic failure" with the following
    > staements:
    >
    > myRs=idXml.recordset;
    > myRs.Find("invdate >#01/01/01#");
    >
    > The error line is pointed to Find statement.
    >
    > Jack


    It appears your answer is at <url:
    http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthfindmethodado.asp
    />

    "Note An error will occur if a current row position is not set before
    calling Find. Any method that sets row position, such as MoveFirst,
    should be called before calling Find."

    However, calling MoveFirst() on an empty RecordSet can also cause an
    error. According to <url:
    http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthmovefirst.asp
    /> "A call to either MoveFirst or MoveLast when the Recordset is empty
    (both BOF and EOF are True) generates an error."

    So, the correct code for you should be:

    myRs = idXml.recordset;
    if (!(myRs.BOF && myRs.EOF)) {
    myRs.MoveFirst();
    myRs.Find("invdate >#01/01/01#");
    }

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
     
    Grant Wagner, Sep 8, 2004
    #2
    1. Advertising

  3. datactrl

    datactrl Guest

    Hi, Grant

    Thanks a lot. I tried the code as you provide. It has the same error as
    before. I wonder whether the Find method is supported on XML ADO. The Move
    and related Move methods all work except Find. And when I traced your code,
    the MoveFirst is successfully done. Because I can see it on the web page on
    which a html table is bound with that XML object. I check MS documents, it
    doesn't memtion about Find. The page is here
    http://msdn.microsoft.com/workshop/author/databind/objmodel.asp

    Jack

    "Grant Wagner" <> wrote in message
    news:...
    > It appears your answer is at <url:
    > http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthfindmethodado.asp
    > />
    >
    > "Note An error will occur if a current row position is not set before
    > calling Find. Any method that sets row position, such as MoveFirst,
    > should be called before calling Find."
    >
    > However, calling MoveFirst() on an empty RecordSet can also cause an
    > error. According to <url:
    > http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthmovefirst.asp
    > /> "A call to either MoveFirst or MoveLast when the Recordset is empty
    > (both BOF and EOF are True) generates an error."
    >
    > So, the correct code for you should be:
    >
    > myRs = idXml.recordset;
    > if (!(myRs.BOF && myRs.EOF)) {
    > myRs.MoveFirst();
    > myRs.Find("invdate >#01/01/01#");
    > }
    >
    > --
    > Grant Wagner <>
    > comp.lang.javascript FAQ - http://jibbering.com/faq
    >
     
    datactrl, Sep 9, 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. nita
    Replies:
    1
    Views:
    888
    Saravana
    Nov 20, 2004
  2. ronaldlee

    Transfer ADO Code to ADO.NET

    ronaldlee, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    477
    Kevin Spencer
    Dec 17, 2004
  3. Replies:
    0
    Views:
    1,329
  4. Andrius
    Replies:
    3
    Views:
    448
    Jonathan Burd
    Feb 1, 2005
  5. Navin
    Replies:
    1
    Views:
    727
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page