VC Beginner's Exception Question... 
Author Message
 VC Beginner's Exception Question...

Hi Folks...

I am experimenting with the snippet below. It works as expected, generally,
but with a flaw. When you move past the last record, I expected that the
try/catch mechanism would catch the error and set the current record to the
first record in the recordset, and it does. BUT, a messagebox first appears
saying "No Current Record".

How can I get rid of the default messagebox/error handling and handle the
exception myself? Thanks if you can help... :-)

Cecil

////////////////////////////////////////////////

 try {
        pRS->MoveNext();
 }

 catch(...) {
         pRS->MoveFirst();
 }

////////////////////////////////////////////////



Wed, 12 Sep 2001 03:00:00 GMT  
 VC Beginner's Exception Question...
Cecil,

Try this:

Quote:
> try {
>        pRS->MoveNext();
> }

> catch(CDaoException* pEX)
> {
>        pEx->Delete();
>         pRS->MoveFirst();
> }

It is also a good idea to test the exception to see what it is just in case.

Keith



Sun, 21 Oct 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. help a beginner's question with vc!

2. C++ beginner question about exception handling

3. VC beginner's problem?

4. Some VC++5 beginner questions

5. A Beginner vc++ question

6. Beginner's question.

7. Large, huge models (beginner's question)

8. Beginner's Question

9. A beginner's question

10. Beginner's array question...

11. A beginner's question about C struct

12. Beginner's Question!

 

 
Powered by phpBB® Forum Software