Results 1 to 40 of 58

Thread: Database connection issue

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Database connection issue

    can someone tell me ???. Why the following code is not working ???. let me know some idea.
    Code:
     private bool OpenConnection(ref OleDbConnection conn)
            {
                try
                    {
                    conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Imp\product_Table.mdb");
                    conn.Open();
    
                    if (conn.State!=conn.Open )
                         {
                        MessageBox.Show("Connection is Not Open");
                        return false;
                       
                         }
                    else
                        {
    
                        return true;
                        
                         }
    
    
                    
                       }
                catch (Exception ex)
                       {
                    MessageBox.Show(ex.Message);
                     return false;
                       }
            }
    Last edited by firoz.raj; May 30th, 2011 at 02:08 PM.

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