Last post Nov 04, 2016 03:31 AM by Bluenose
Nov 02, 2016 02:21 PM|Bluenose|LINK
I have a Web page here: www.dimadayoub.net/forgot.aspx
When I type in the email of a user who exists in the database and click 'Send', I get the following error:
'System.Data.OleDb.OleDbException: Operation must use an updateable query'.
The code I am using in my forgot.aspx.vb file is this:
Protected Sub btnForgot_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnForgot.Click
Const ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|students.mdb;"
'Const ConnectionString As String = "Data Source=|DataDirectory|students.mdb"
Dim uniqueCode As String = Guid.NewGuid().ToString("N")
Dim recordExists As Boolean = False
Using conn As New OleDbConnection(ConnectionString)
Using cmd As OleDbCommand = conn.CreateCommand()
cmd.CommandText = "UPDATE university SET uniqueCode = @uniqueCode WHERE strEmail = @strEmail"
Dim recordsAffected As Integer = cmd.ExecuteNonQuery()
If recordsAffected <> 0 Then recordExists = True
According to this post,
http://stackoverflow.com/questions/24798509/system-data-oledb-oledbexception-operation-must-use-an-updateable-query my database permissions must be set to 'Modify' and not simply 'Read'. However, in Visual Studio, ARE set to Modify, Read & Execute, Read,
and Write. This database file is the same one I compile and upload to my Web hosting service.
However, do I also need to go to my server Control Panel to set permissions (assuming the Stackoverflow responses are correct)?
Nov 02, 2016 02:33 PM|senthilwaits|LINK
Please refer this article
Nov 02, 2016 04:04 PM|Bluenose|LINK
Thanks, Senthiwaits, for your reply
According to the link you kindly provided, "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".
My 'students.mdb' file is in App_Data and the permissions are as follows:
System, Steve, and Administrators have all Permissions, and Home Users now has all Permissions except Full Control (I have now given it the 'Modify' Permission).
I am not too sure what the article means when it is refers to IUSR_machinename, or IIS APPPOOL/name_of_application_pool, but in App_Data | Properties | Security | Advanced | Effective Access | Select a user | Advanced | Find Now I can see nothing against
'Interactive' or 'IUSR' but under Steve-PC (the name of this PC), I see IIS_IUSRS.
I then saved the changes, compiled the entire project and uploaded it but, again, in
http://www.dimadayoub.net/forgot.aspx when I type in the email address of a valid user and press 'Send', I get the same 'System.Data.OleDb.OleDbException: Operation must use an updateable query'.
When I go to 'forgot.aspx' in Visual Studio and load the page locally, I also get an error (which I am trying to resolve), but that is related to SMTP and email.
Thanks again for your reply.
Nov 03, 2016 08:54 AM|Brando ZWZ|LINK
I am not too sure what the article means when it is refers to IUSR_machinename, or IIS APPPOOL/name_of_application_pool, but in App_Data | Properties | Security | Advanced | Effective Access | Select a user | Advanced | Find Now I can see nothing against 'Interactive'
or 'IUSR' but under Steve-PC (the name of this PC), I see IIS_IUSRS.
According to your description, I suggest you could click the edit and add the iusr group into security group.
More details you could refer to follow steps：
1.Click the edit button.
2.Click the add button.
3.Type IUSR into textbox.
4.Click check Names button
Then you could add permissions.
Since we don't know your IIS version.
If your IIS version is more than 7, you could use IUSR.
If not you should not use IUSR_machine.
Nov 04, 2016 01:04 AM|Bluenose|LINK
Very many thanks for your comprehensive reply.
I have been to IIS Manager and that doesn't tell me which version of IIS I have. In Control Panel | System and Security | Administrative Tools, I can see two listed items for IIS:
IIS 6.0 Manager (No entries)
IIS Manager (Points me to Windows 10 and, here,
https://technet.microsoft.com/library/hh831768.aspx to Windows Server 2012 R2, Windows Server 2012.
I have followed what you have suggested, namely:
Does that look about right?
Many thanks again.
Nov 04, 2016 01:34 AM|Brando ZWZ|LINK
Does that look about right?
According to your image, I found you set the VS's App_Data permissions.
I suggest you could make sure you have changed deployed file's App_Data folder permissions, not the design file's App_Data permissions.
Besides, you could see the version of IIS in below image:
Nov 04, 2016 01:47 AM|Bluenose|LINK
It says Version 10.0.14393.0
The App_Data folder I applied the permissions to is the one that holds my Access database in Documents | Visual Studio 2013 | mainProject - the folder that holds my VS files for that particular project.
I haven't changed anything in the App_Data folder in Visual Studio's Solution Explorer.
Nov 04, 2016 03:31 AM|Bluenose|LINK
I am just looking at your comment here: 'If your IIS version is more than 7, you could use IUSR'.
Hopefully, that would take care of the error message I was getting, but when I go to App_Data (the actual folder that I have now modified and the one that is compiled and uploaded to the server - with my Web hosting service - I still see this:
Shouldn't this PC, named STEVE-PC, show along IUSR?