Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hiiii to all i have completed my windows application. I created the setup of my project but when its setup runs,it shows an error in my first form.Actually i am using acess2003 database as a local database. and uses the following connection string
C#
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/Furniture.mdb");

i m using windows7 as OS and my system is 32bit system. it show me the error
Operation must use an updateable query
i search a lot and change the security setting of database file but still it shows the same prblm... plz help
Posted
Updated 17-Aug-12 20:42pm
v2

One quite likely reason is that the user running the program doesn't have read-write access to the database file, especially if it is located in program files folder.

So check the directory and file permissions and moodify them if needed. You can also consider changing the location of the database file to another, more asily accessible folder.
 
Share this answer
 
Comments
Espen Harlinn 19-Aug-12 8:31am    
Good point :-D
Wendelius 21-Aug-12 1:06am    
Thanks :)
When a Jet 4.0 database (the actual type of database represented by your "Access" mdb file) is deployed in a multi-user environment, an .ldb file is created whenever the database is opened. The .ldb file contains details which include who has opened the file, and primarily serves to prevent opened records being written to by another user.
In the context of an ASP.NET application, who the "user" is will depend on the platform: for XP Pro machines, the user is the ASPNET account. On Windows Server 2003, 2008 and Vista, it is the NETWORK SERVICE account. However, if you have ASP.NET Impersonation enabled, the default user account will be IUSR_machinename, or whichever account you have applied. If you are unsure which account your ASP.NET application is running under, Environment.UserName will return it. To be able to create, write to and delete the required .ldb file, the relevant user needs MODIFY permissions on the folder that the .mdb file is in.
To set this permission, right click on the App_Data folder (or whichever other folder you have put the mdb file in) and select Properties. Look for the Security tab. If you can't see it, you need to go to My Computer, then click Tools and choose Folder Options.... then click the View tab. Scroll to the bottom and uncheck "Use simple file sharing (recommended)". Back to the Security tab, you need to add the relevant account to the Group or User Names box. Click Add.... then click Advanced, then Find Now. The appropriate account should be listed. Double click it to add it to the Group or User Names box, then check the Modify option in the permissions. That's it. You are done.
 
Share this answer
 
Comments
Member 8233601 18-Aug-12 4:15am    
sir i have put my mdb file in debug folder and i am using windows7 which is currently out of service. now plz help me out through each step o solve this prblm..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900