Click to See Complete Forum and Search --> : Viewing MSAccess reports using ASP.NET


Shanta
August 9th, 2005, 09:41 AM
Hi,

I'm trying to view Microsoft Access reports using ASP.Net but I keep getting the following error (message.System.Runtime.InteropServices.COMException: تعذر على Microsoft Access فتح قاعدة البيانات لأنها مفقودة أو مفتوحة للاستخدام الخاص من قبل مستخدم آخر.)

The arabic words read something as follows: Microsoft Access could not open the database because it is either missing or already exclusively opened by another user.

P.S. I managed to get it to work using C#.Net as a normal windows application, but I couldn't do the same thing using ASP.Net.

The follwoing is the ASP.NET code I'm using:

private void Button1_Click(object sender, System.EventArgs e)
{
string myReport = "Invoice";
Access.Application RAcc = new Access.ApplicationClass();
string FilePath = Server.MapPath("Northwind.mdb");
RAcc.OpenCurrentDatabase(FilePath,true,"");
RAcc.Visible = true;
RAcc.DoCmd.Maximize();
RAcc.DoCmd.Maximize();
RAcc.DoCmd.OpenReport(myReport, Access.AcView.acViewPreview,"","",Access.AcWindowMode.acWindowNormal,"");

}

This code snapshot will be executed on a button click. Obviously, the whole program contains more code, but the problem arises in this bit.

your help will be highly appreciated.