public fmSearchEngine() { InitializeComponent(); FileIsChosen += OnFileIsChosen; SearchBegin += OnSearchBegin; SearchEnd += OnSearchEnd; if (Connection != null) { Connection.Close(); } Connection = DBConnection.GetInstance(GetConnectionString()); }
// The bulk of the clean-up code is implemented in Dispose(bool) protected virtual void Dispose(bool disposing) { if (disposing) { // free managed resources _dbConnection.Close(); _dbConnection.Dispose(); } // free native resources here if there are any }
private void LoadDataFromDB(bool ReconnectFlag = true) { if (ReconnectFlag || Connection == null) { if (Connection != null) { Connection.Close(); } Connection = DBConnection.GetInstance(GetConnectionString()); } string sql = "SELECT [Id],[Content] FROM [dbo].[Pages];"; Connection.Open(); DataTable dt = Connection.ExecuteQuery(sql); Connection.Close(); DocumentCorpus.Adapter(dt); }
// The bulk of the clean-up code is implemented in Dispose(bool) protected virtual void Dispose(bool disposing) { if (disposing) { lock (_dbConnection) { _dbConnection.Close(); _dbConnection.Dispose(); } } // free native resources here if there are any }
public void Close() { sqlConnection.Close(); }