none
System.Data.OleDB access issue when running on Win7 Starter Edition with UAC on RRS feed

  • Question

  • I hope this is the right forum for this question. I have a very simple WPF (.Net FW 3.5.1) application. It runs without problems on my Dev machine (Vista Business, UAC on or off). It uses System.Data.OLEDB to perform CRUD operations on data in an Access 2000 database .mdb file  (Provider=Microsoft.Jet.OLEDB.4.0)file. The database file is stored in C:\ProgramData\[my company name]\[my app name]; this directory allows "Everyone" access.  All is well on my dev machine. One of the target platforms, however is Win7 Starter Edition running on a Netbook. In this case, there is a problem, as follows:

    With UAC turned off, my code can add records of any kind to the database with no problem. When I turn on UAC (by moving the slider anywhere but the bottom level, in Control Panel), adding a record to one of the tables results in a Security Violation that actually causes a runtime error that my exception handling can't fully deal with; however, what I can tell is that it is a System.Security.SecurityException. I'm using a command string to add the record, like this:

    cmd =

    cmd.CommandType = System.Data.

    new OleDbCommand(cmdstring, Globals.DBConn);

     

    CommandType.Text;

    cmd.ExecuteNonQuery();

    where cmdstring is text I create on the fly for a SQL Insert, and Globals.DBConn is my OleDB connection.

    Now, the odd thing is that on my dev platform, with UAC on or off, there is no error when this code executes. But on the Win7 Starter platform, there is an error with UAC on. I recall hearing about "SQL injection" attacks; is this stricter security behavior a means of trying to prevent this? What can I do about this so that I can run the target platform with UAC on?

    Thanks in advance for any guidance someone can give me with this!!!

    Wednesday, June 2, 2010 6:31 PM

Answers

  • I'm not sure whether the user in this instance is an Admin or standard user, but when working with Access database files full permissions to the folder are required, which includes Delete permissions as well in order for the database engine to work with the corresponding .LDB file.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by ElizabethC Thursday, June 3, 2010 1:41 AM
    • Unmarked as answer by ElizabethC Thursday, June 3, 2010 1:43 AM
    • Marked as answer by ElizabethC Thursday, June 3, 2010 1:43 AM
    Wednesday, June 2, 2010 10:27 PM

All replies

  • I'm not sure whether the user in this instance is an Admin or standard user, but when working with Access database files full permissions to the folder are required, which includes Delete permissions as well in order for the database engine to work with the corresponding .LDB file.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Marked as answer by ElizabethC Thursday, June 3, 2010 1:41 AM
    • Unmarked as answer by ElizabethC Thursday, June 3, 2010 1:43 AM
    • Marked as answer by ElizabethC Thursday, June 3, 2010 1:43 AM
    Wednesday, June 2, 2010 10:27 PM
  • Aha! That did it! Thanks very much.

    Thursday, June 3, 2010 1:44 AM