private void editar(long id) { IDbCommand dbCommand = dbConnection.CreateCommand(); dbCommand.CommandText = string.Format("select * from articulo where id={0}", id); IDataReader dataReader = dbCommand.ExecuteReader(); dataReader.Read(); entryNombre.Text = (string)dataReader["nombre"]; spinButtonPrecio.Value = Convert.ToDouble((decimal)dataReader["precio"]); dataReader.Close(); saveAction.Activated += delegate { Console.WriteLine("saveAction.Activated"); IDbCommand dbUpdateCommand = dbConnection.CreateCommand(); dbUpdateCommand.CommandText = "update articulo set nombre=:nombre, precio=:precio where id=:id"; DbCommandExtensions.AddParameter(dbUpdateCommand, "nombre", entryNombre.Text); DbCommandExtensions.AddParameter(dbUpdateCommand, "precio", Convert.ToDecimal(spinButtonPrecio.Value)); DbCommandExtensions.AddParameter(dbUpdateCommand, "id", id); dbUpdateCommand.ExecuteNonQuery(); Destroy(); }; }
public IList <Paciente> BuscarPulicoAlvo() { using (var command = _conn.CreateCommand()) { command.Parameters.Add(DbCommandExtensions.CreateParameter(command, "PO_CURSOR", null, ParameterDirection.Output, OracleDbType.RefCursor)); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GDD.TESTE_TNH2"; return(this.ToList(command).ToList()); } }
private void nuevo() { //inicializo los controles que quiera entryNombre.Text = "Pon el nombre"; spinButtonPrecio.Value = 1; saveAction.Activated += delegate { Console.WriteLine("saveAction.Activated"); IDbCommand dbCommand = dbConnection.CreateCommand(); dbCommand.CommandText = "insert into articulo (nombre, precio) values (:nombre, :precio)"; DbCommandExtensions.AddParameter(dbCommand, "nombre", entryNombre.Text); DbCommandExtensions.AddParameter(dbCommand, "precio", Convert.ToDecimal(spinButtonPrecio.Value)); dbCommand.ExecuteNonQuery(); Destroy(); }; }
public override void AdjustCommand(DbCommand command) { DbCommandExtensions.ApplyYeke(command); base.AdjustCommand(command); }