简体   繁体   中英

Open SQLITE read-only in c#

I trying to open an SQLITE database in read-only mode according this link: Connection strings for SQLite

SQLITE Connection string

string ConString = string.Format(@"Data Source={0}dbname.s3db;Version=3;New=False;Compress=True;Mode = Read Only;Temp Path={1};"
                , System.AppDomain.CurrentDomain.BaseDirectory,TempPath); 

            using (SQLiteConnection connection = new SQLiteConnection(ConString))
            {
                    //Rerun Exception
                    connection.Open();

Exception:

Valid parameters: Data Source= (required) Version= (default: 2) New=True|False (default: False) Compress=True|False (default: False) UTF8Encoding=True|False (default: False)

according Opening A New Database Connection by setting read-only mode with the SQLITE_OPEN_READONLY flag can open database in read only mode,but dose any one done it in c#?

I just burn my application on CD and it's work on read-only mode.

It's seems this is not required to set mode read only for read only device like CD or DVD,its work fine:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM