Connecting Tech Pros Worldwide Forums | Help | Site Map

MS XML ADO "Fiind" method problem

datactrl
Guest
 
Posts: n/a
#1: Jul 23 '05
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



Grant Wagner
Guest
 
Posts: n/a
#2: Jul 23 '05

re: MS XML ADO "Fiind" method problem


datactrl wrote:
[color=blue]
> 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[/color]

It appears your answer is at <url:
http://msdn.microsoft.com/library/en...dmethodado.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...hmovefirst.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 <gwagner@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

datactrl
Guest
 
Posts: n/a
#3: Jul 23 '05

re: MS XML ADO "Fiind" method problem


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/a...d/objmodel.asp

Jack

"Grant Wagner" <gwagner@agricoreunited.com> wrote in message
news:413F3EBA.4C69AA09@agricoreunited.com...[color=blue]
> It appears your answer is at <url:
> http://msdn.microsoft.com/library/en...dmethodado.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...hmovefirst.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 <gwagner@agricoreunited.com>
> comp.lang.javascript FAQ - http://jibbering.com/faq
>[/color]


Closed Thread