MS XML ADO "Fiind" method problem

D

datactrl

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
 
G

Grant Wagner

datactrl said:
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#");
}
 
D

datactrl

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top