public void ExecuteReader(string command, Action <DbDataReader> callback) { LolipopUtils.Debug("SQL Command", command); try { this.Connection?.Open(); this.Command.CommandText = command; this.Command.Connection = this.Connection; callback(this.Command.ExecuteReader()); } catch (DbException) { throw; } finally { this.Connection?.Close(); } }
public int ExecuteNonQuery(string command) { LolipopUtils.Debug("SQL Command", command); int result = -1; try { this.Connection?.Open(); this.Command.CommandText = command; this.Command.Connection = this.Connection; result = this.Command.ExecuteNonQuery(); } catch (DbException) { throw; } finally { this.Connection?.Close(); } return(result); }