private void menuItem6_Click(object sender, EventArgs e)
        {
            SqlCeStorageHandler.CloseConnection();
            if (File.Exists(DataStoreHelper.ListDbFileName))
            {
                File.Delete(DataStoreHelper.ListDbFileName);
            }

            Close();
        }
예제 #2
0
        /// <summary>
        /// Create a database if one does not exist.
        /// </summary>
        public static void InitializeDataStore()
        {
            _dbConnectionstring = String.Format(CONNECTION_STRING_TEMPLATE, ListDbFileName);
            if (!File.Exists(ListDbFileName))
            {
                CreateDatabase();
            }

            // We maintain an static open connection to the local SQL CE database
            // for the time the application runs. In case we switch users, without restarting the application, the connection
            // needs to be reset so that it does not point to the previous users database.
            SqlCeStorageHandler.CloseConnection();
        }