CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    6

    What if oleDb throw an Exception

    i can't connect to my database the OLEDB throw the following error

    An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

    How can you handel it

    thanks

  2. #2
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    Re: What if oleDb throw an Exception

    to catch the exception you should use the try catch statements...

    try{
    My_OleDBConnection.Open();
    }
    catch(OleDbException m_Ex)
    {
    Messagebox.Show(m_Ex.Message);
    }
    Finally
    {
    //free resource here...
    }
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured