private DaoErrMsg ConnectSQLite() { DaoErrMsg Err = new DaoErrMsg(); if (_SQL != null) { //表示已開啟過;// return(Err); } //連接Sqlite;// string SQLiteConn = string.Format(@"Data source={0}; Password=Myp53750804; DateTimeKind=Utc", DaoConfigFile.Instance.FileDatabase); _SQL = new DaoDbCommon(SQLiteConn, new SQLiteConnection()); Err = _SQL.Connect(); if (Err.isError) { System.Diagnostics.Debug.WriteLine(Err.ErrorMsg); _SQL = null; return(Err); } //第一次開啟DB時,要開啟ForeignKeys功能;// OpenForeignKeys(); return(Err); }
/// <summary> /// 關閉資料庫連接 /// </summary> internal void CloseDatabase() { if (_SQL == null) { return; } _SQL.Close(); _SQL = null; }