Hello Frends,
I have an application where I am trying to connect MS Access DB with a ASP.Net(C#) Page and the same application also connect to the MS SQL Server (Working Fine). While connecting I am having following error:
_____________________________________________________________________________________
Server Error in '/manager' Application.
The Microsoft Jet database engine cannot open the file 'C:\Inetpub\vhosts\brightlightremc.com\httpdocs\manager'. It is already opened exclusively by another user, or you need permission to view its data.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: The Microsoft Jet database engine cannot open the file 'C:\Inetpub\vhosts\brightlightremc.com\httpdocs\manager'. It is already opened exclusively by another user, or you need permission to view its data.
Source Error:
Line 28: conna = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " +Server.MapPath(ct));
Line 29: comm = new OleDbCommand("Select * from stockin where sl="+Request.QueryString["id"]+" ", conna);
Line 30: conna.Open();
Line 31: dr = comm.ExecuteReader();
Line 32: //DataGrid1.DataSource = dr;
Source File: c:\inetpub\vhosts\brightlightremc.com\httpdocs\manager\Off_customer_joining.aspx.cs Line: 30
Stack Trace:
[OleDbException (0x80004005): The Microsoft Jet database engine cannot open the file 'C:\Inetpub\vhosts\brightlightremc.com\httpdocs\manager'. It is already opened exclusively by another user, or you need permission to view its data.]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +969373
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863644
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.OleDb.OleDbConnection.Open() +40
Off_customer_joining.Page_Load(Object sender, EventArgs e) in c:\inetpub\vhosts\brightlightremc.com\httpdocs\manager\Off_customer_joining.aspx.cs:30
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
_____________________________________________________________________________________
Points to be noted: I am Using a shared server of a hosting company.
Below the code I am using,
protected void Page_Load(object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoServerCaching();
HttpContext.Current.Response.Cache.SetNoStore();
String ct;
ct = Request.QueryString["ct"];
OleDbConnection conna;
OleDbCommand comm;
OleDbDataReader dr;
conna = new OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " +Server.MapPath(ct));
comm = new OleDbCommand("Select * from stockin where sl="+Request.QueryString["id"]+" ", conna);
conna.Open();
dr = comm.ExecuteReader();
//DataGrid1.DataSource = dr;
//DataGrid1.DataBind();
//foreach (DataRow row in dr.Tables[0].Rows)
//{
//txt_form.Text = row[0].ToString();
//txt_name.Text = row[1].ToString();
//txt_instamt.Text = row[2].ToString();
//txt_term.Text = row[3].ToString();
//txt_scheme.Text = row[4].ToString();
//}
txt_form.Text = dr["formno"].ToString();
conna.Close();
Waiting for valuable suggestions!!