mercredi 9 septembre 2015

why i get attempt to write a readonly database?

i'v i program build with c# and sqlite.. once i Create the package and move the installer to any other machine . . i get this attempt to write a readonly database i think this error accrued from the creation code which is :

        if (!System.IO.File.Exists("Key.sqlite"))
        {

            SQLiteConnection.CreateFile("Key.sqlite");
            using (SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=Key.sqlite;Version=3;"))
            {
                m_dbConnection.Open();
                string createTableQuery = @"CREATE TABLE IF NOT EXISTS [MyKey] (
                      [ID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
                      [Key] VARCHAR(2048)  NULL
                      )";
                SQLiteCommand command = new SQLiteCommand(createTableQuery, m_dbConnection);
                command.ExecuteNonQuery();
                m_dbConnection.Close();
            }

Aucun commentaire:

Enregistrer un commentaire