none
Modify Microsoft Access database programmatically RRS feed

  • Question

  • My application is in C# and its database is Microsoft Access 2003. I want to update a view (Query) in the database programmatically.

    After searching I found out that I must use ADOX.( from this link http://msdn2.microsoft.com/en-us/library/aa140021(office.10).aspx)

    The problem I have faced is that I cannot open the database for changes, when I set the ActiveConnection property I got this error:

    [An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in ModifyView.exe

    Additional information: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.]

    Catalog catalog = new Catalog();

    catalog.ActiveConnection = ("Provider=Microsoft.Jet.OLEDB.4.0;" +

                       "Data Source=D:\\AccessDB\\MainDB.mdb;" +

                      "Jet OLEDB:Engine Type=5");

     

    At first I thought because of the version of my database this problem occurs but

    I could create a database in Access 2000 format by the following code but I cannot open it either!

     

     

    //catalog.Create("Provider=Microsoft.Jet.OLEDB.4.0;" +

    //       "Data Source=D:\\AccessDB\\NewMDB.mdb;" +

    //       "Jet OLEDB:Engine Type=5");

     

     

     

    I’d be thankful if you guid me wether my solution is proper or not and how I can fix this problem?

    Thanks in advance,

    Saeideh

     

    Sunday, September 23, 2007 8:03 AM

All replies