locked
dll for MS Access Distribution RRS feed

  • Question

  • Hi All,
    I have been in a project which intend to give data in the 'mdb' file format. The actual requirement is like this....The tool should be completely independent on local MS Access Version ...for that I was supposed to reference a distributable dll along with the set up,for this I just have added Access com object and that had worked fine too...but when i check the data I could found some data loss....Also one more challenge is my tool should be such that it should give report though there is no MSOffice is being installed in the cient sys. My code goes like this I used 'Access.CurrentDb().Execute(Create/Update query....)...to alter data, So somebody plss help me why this function of Application class has failing to export complete data..also help me regarding how i could give client a disributable dll that would work though there is no Office has been installed
    Friday, June 5, 2009 10:59 AM

Answers

  • You can use the classes in the System.Data.OleDb namespace to manipulate Access databases (as long as you're only using Access to store the data, no forms or reports). The OleDb driver for Access is part of Windows, so no special dll is required.

    For example, instead of using Access.CurrentDb().Execute(...), you open a connection to the database and execute a command:

    using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\yourdatabase.mdb")
    {
      conn.Open();
      using (OleDbCommand command = conn.CreateCommand())
      {
        command.CommandText = "UPDATE ...";
        command.ExecuteNonQuery();
      }
    }

    Mark the best replies as answers!
    • Marked as answer by Zhi-Xin Ye Thursday, June 11, 2009 7:51 AM
    Monday, June 8, 2009 12:32 PM