CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Location
    G day Mayt Land
    Posts
    971

    Talking opening an access db using Vc#

    I downloaded teh sample code included for db example from msdn but it was out of date .Phewww
    I created a dummy Access db with atable that has a few records and columns to populate my GridControl .
    However for some reason (whether its a param missing or access security) am unable to connect to the database. Has anyone done anything like this that can help ? cheers

    System.Data.OleDb.OleDbConnection conn = new
    System.Data.OleDb.OleDbConnection();
    conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= D:\Mooo.mdb";
    try
    {
    conn.Open();
    // Insert code to process data.
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.ToString());
    MessageBox.Show("Failed to connect to data source");
    }
    finally
    {
    conn.Close();
    this.Close();
    }

    Thanks in Advance.

  2. #2
    Join Date
    May 1999
    Location
    G day Mayt Land
    Posts
    971

    Re: opening an access db using Vc#

    oK GOT IT.
    THE MDAC WAS OF VERSION 2.5 ..

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

    Re: opening an access db using Vc#

    moved to C# forum...

    Saeed, you are "Member+". so, please double check the forum you are posting to. that's not too hard to do. posting C# post in C++.NET is not quite good...
    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.

  4. #4
    Join Date
    May 1999
    Location
    G day Mayt Land
    Posts
    971

    Re: opening an access db using Vc#

    that was not intentional ...
    guess eyes get tired now and then
    ignore this post please

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