Git Product home page Git Product logo

Comments (12)

ErikEJ avatar ErikEJ commented on May 22, 2024

Could you clarify why you think full access is required?

Do you specify temp paths in your connection string?

from sqlcetoolbox.

quentinw avatar quentinw commented on May 22, 2024

I've tried revoke full access for everyone then failed to connect , then grant read and write, failed, grant delete and fail . Finally grant full then ok.

I'm using icacls command

from sqlcetoolbox.

ErikEJ avatar ErikEJ commented on May 22, 2024

Fail??? What does it mean? Also, you can control access to the folder..

from sqlcetoolbox.

quentinw avatar quentinw commented on May 22, 2024

Yes, fail. Using the sqlceconnect and fail.

I could control access to folder, but as the user should access to the file, i can't forbid his access right.

The only solution now is to audit the delete action and to perform regular checking.

However, could i only allow user to read/write/update the sdf but not delete? Of course, user could still read/write/update/delete record in the sdf.

from sqlcetoolbox.

ErikEJ avatar ErikEJ commented on May 22, 2024

I am trying to help you - but "fail" can mean 1000 different things - could you provide the exact SqlCeException error you are getting, please!

What error do you get if you revoke delete?

from sqlcetoolbox.

quentinw avatar quentinw commented on May 22, 2024

The code is not beside me and will revert to you tomorrow. Thanks for your help

from sqlcetoolbox.

alexng513 avatar alexng513 commented on May 22, 2024

Hi ErikEJ, this is quentinw's colleague.

The SqlCeException is captured and below are number of attributes of the Exception object

Message
Access to the database file is not allowed. [ File name = SDF File Path ]

NativeError
25039

StackTrace
at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
at System.Data.SqlServerCe.SqlCeConnection.Open()

Besides, the connection string is as below:-
Data Source=|DataDirectory|SDF File Path;Password = File Password

We are opening the connection as below:-
SqlCeConnection conn = new SqlCeConnection(ConnectionString)
conn.Open();

then we encountered the above message.

We used the below command to revoke the delete right of the file:-
icacls SDF File Path /deny Everyone:(D)

Even if we tried to grant (R,W,RX) rights but it still failed to run.

Please help to advise. Thanks for your help.

from sqlcetoolbox.

ErikEJ avatar ErikEJ commented on May 22, 2024

Do you set the location of DataDirectory in code?

Did you try a full path iso DataDirectory

Did you try to specfiy temp path? https://msdn.microsoft.com/da-dk/library/system.data.sqlserverce.sqlceconnection.connectionstring%28v=vs.100%29.aspx

from sqlcetoolbox.

alexng513 avatar alexng513 commented on May 22, 2024

We didn't set the location of DataDirectory or specify the temp path. The sdf file is placed at a different directory as the program.

from sqlcetoolbox.

ErikEJ avatar ErikEJ commented on May 22, 2024

What I am suggesting is that you try to do that!

If you use DataDirectory you have no control over the location of the file... Set DataDirectory value in code, or use a full path in your connection string.

from sqlcetoolbox.

alexng513 avatar alexng513 commented on May 22, 2024

We tried taking away the DataDirectory away and also adding temp path to the connection string but it still fails, the same error is occurred. Below is the string we used.

DBConnectionString = "Data Source=C:\TESTDB1\TESTDB.sdf;Password = password;temp path=C:\TESTDB2";

This string will work if the delete privilege is not revoked.

from sqlcetoolbox.

ErikEJ avatar ErikEJ commented on May 22, 2024

OK, I guess it is not possible then...

from sqlcetoolbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.