E_FAIL error, problem with Stored procedure

Hello,

Used: Delphi 5, SQL server 7 and ADO

Problem case: application that does exports from database to flat files.
I have a stored procedure that selects records, then does an update for
those records (setting a flag that they are exported).  This all happens in
1 stored procedure, and all runs fine from the query analyzer, and sometimes
fine from the application.

When I run this query from within the delphi application with ADOStoredProc,
I can open this stored proc, but I cannot work with it.  When I make calls
to recordcount or last, the application raises the "Data provider or other
service returned an E_Fail status".  The weird thing is that I can open the
recordset, and do a next until I'm some records away from the last record.
Then, on that "Next" statement the same error is thrown.  It is not always
the same record, it varies when when I change the select statement.
The update of the records in the stored proc is tried with and without "Set
Nocount" modifiers, without any result.
Some exports that use the same stored proc, but with other parameters run
fine, but some fail without any logical reason.  The dataset that is
returned in the query analyzer seems perfectly normal, the (maybe) problem
records differ in no way from the previous records.

Anyone have any idea about what can cause this problem?

Please answer me or mail me asap, we cannot provide daily support for
another 2 weeks :)

Thank you,

Jan Jacobs - jaco...@spector.be
Programmer - Spector Photo Group