locked
Access permissions question RRS feed

  • Question

  • User-1793215261 posted

    Hello

    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"
                    cmd.Parameters.AddWithValue("@uniqueCode", uniqueCode)
                    cmd.Parameters.AddWithValue("@strEmail", strEmailTextBox.Text.Trim())
    
                    conn.Open()
                    Dim recordsAffected As Integer = cmd.ExecuteNonQuery()
                    If recordsAffected <> 0 Then recordExists = True
                End Using
            End Using

    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)?

    Thank you.

    Wednesday, November 2, 2016 2:21 PM

Answers

  • User283571144 posted

    Hi Bluenose,

    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:

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 4, 2016 1:34 AM

All replies

  • Wednesday, November 2, 2016 2:33 PM
  • User-1793215261 posted

    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:

    http://www.dimadayoub.net/dataBase_question.jpg

    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.

    Wednesday, November 2, 2016 4:04 PM
  • User283571144 posted

    Hi Bluenose,

    Bluenose

    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
    5.Click OK

    Then you could add permissions.

    Image:

    Note:

    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.

    Best Regards,

    Brando

    Thursday, November 3, 2016 8:54 AM
  • User-1793215261 posted

    Hello Brando

    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.

    Blueie

    Friday, November 4, 2016 1:04 AM
  • User283571144 posted

    Hi Bluenose,

    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:

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 4, 2016 1:34 AM
  • User-1793215261 posted

    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.

    Friday, November 4, 2016 1:47 AM
  • User-1793215261 posted

    Hello Brandon

    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?

    Many thanks again.

    Friday, November 4, 2016 3:31 AM