示例#1
0
        private void Close()
        {
            try
            {
                if (_connection != null)
                {
                    _connection.Close();
                    _connection.Dispose();
                    _connection = null;

                    if (_command != null)
                    {
                        _command.Parameters.Clear();
                        _command.Dispose();
                        _command = null;
                    }

                    _connectionString.Clear();
                    _connectionString = null;
                }
            }
            catch
            {
            }
        }
示例#2
0
        public bool SetDatabaseParameters_SQLite()
        {
            try
            {
                //DialogResult dr = openFileDialog1.ShowDialog();
                //string file = openFileDialog1.FileName;

                SQLiteConnectionStringBuilder sqlCnnStrBld = new SQLiteConnectionStringBuilder();
                sqlCnnStrBld.DataSource  = ConfigurationManager.AppSettings["dbDataSource_SQLite"]; // AppDomain.CurrentDomain.BaseDirectory + ConfigurationManager.AppSettings["dbDataSource_SQLite"];
                sqlCnnStrBld.Password    = txtCurrentPassword.Text.Trim();                          //ConfigurationManager.AppSettings["dbPassword_SQLite"].ToString();
                sqlCnnStrBld.JournalMode = SQLiteJournalModeEnum.Persist;
                sqlCnnStrBld.SyncMode    = SynchronizationModes.Full;
                sqlCnnStrBld.Version     = 3;
                sqlCnnStrBld.PageSize    = 4096; //512 katları, default:4096
                strSQLconn_SQLite        = sqlCnnStrBld.ConnectionString;
                sqlCnnStrBld.Clear();
                strTableName = ConfigurationManager.AppSettings["dbImageTable_SQLite"].ToString();
                return(true);
            }
            catch
            {
                return(false);
            }
        }