I working on c# project and I get a error whenever I try to open the connection to a MS Access file. The error reads "Could not lock file". This is an ASP.net project. I am using visual studio .net. I have tried the same code in a windows application in c# and it works just fine. I have gave permissions to the ASPNET user to this file and folder to include write permissions. I have also added the ASPNET user permissions to IIS. Can someone please help me out with this. Below is the code:
Code:private void btnSubmit_Click(object sender, System.EventArgs e) { try { string strSql = ""; string strConnectionString = ""; strSql = "SELECT * FROM Orders"; strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Password=\"\";User ID=Admin;Data Source=D:\\Databases\\Northwind.mdb;Mode=Share Deny None;Persist Security Info=False"; OleDbConnection conn = new OleDbConnection(strConnectionString); OleDbDataAdapter da = new OleDbDataAdapter(strSql, conn); DataSet ds = new DataSet(); conn.Open(); da.Fill(ds); conn.Close(); this.DataGrid1.DataSource = ds.Tables[0].DefaultView; this.DataGrid1.DataBind(); } catch(Exception err) { this.lbl1.Text = err.Message; } }



LinkBack URL
About LinkBacks


