Last post Apr 08, 2013 02:21 AM by oned_gk
Apr 08, 2013 12:19 AM|Rakesh Ravichandran|LINK
Hi. I'm Rakesh.
I'm trying to use my ASP.net code for connecting my datatbase( Created using Microsoft Access 2007).
There is no error in the code but when i execute it, the following is displayed:
System.Data.OleDb.OleDbException: Cannot update. Database or object is read-only.
And the code i used was:
public void insert(string a, string b, string c)
string sExcelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="my path";Extended Properties=Excel 8.0;Persist Security Info = False";
OleDbConnection con = new OleDbConnection(sExcelConnectionString);
OleDbCommand cmd = new OleDbCommand ("insert into Table1 values("+a+",'"+b+"','"+c+"')",con);
Somebody please help.
I'll be glad if it is solved soon...
Apr 08, 2013 01:02 AM|Rajneesh Verma|LINK
It seems that you .mdb file is read only, Right click on it then properties, remove read only attribute. If its not working then give the permission to current user as read/write (also for testing can give for everyone read/write permission) permission.
Apr 08, 2013 02:21 AM|oned_gk|LINK
Try use Microsoft.ACE.OLEDB.12.0 provider instead Microsoft.Jet.OLEDB.4.0 (if using 2007/2010 file format)