/// <summary> /// 关闭数据库连接 /// </summary> public void CloseConnection() { //销毁Command if (dbCommand != null) { dbCommand.Cancel(); } dbCommand = null; //销毁Reader if (dataReader != null) { dataReader.Close(); } dataReader = null; //销毁Connection if (dbConnection != null) { dbConnection.Close(); } dbConnection = null; }
//关闭数据库连接,每次测试结束的时候都调用关闭数据库连接 public void CloseSQLConnection() { if (command != null) { command.Cancel(); } if (reader != null) { reader.Close(); } if (connection != null) { connection.Close(); } command = null; reader = null; connection = null; print("已经断开数据库连接"); }
protected void Disconnect() { //销毁Command if (dbCommand != null) { dbCommand.Cancel(); } dbCommand = null; //销毁Reader if (dataReader != null) { dataReader.Close(); } dataReader = null; //销毁Connection if (dbConnection != null) { dbConnection.Close(); } dbConnection = null; }
private void Finally(SqliteCommand command, SqliteDataReader reader = null) { command.Cancel(); command.Dispose(); reader?.Close(); }
public void destroy() { mConnection.Close(); mCommand.Cancel(); }
// 【关闭数据库】 public void CloseDataBase() { connection.Close(); command.Cancel(); }