Delphi - append en lugar de post...?

 
Vista:

append en lugar de post...?

Publicado por JuanMa (20 intervenciones) el 24/04/2010 02:42:19
hola gente, a ver si me pueden dar una manito
este form en lugar de modificar (adoqueryX.post) esta agregando nuevos registros, la verdad no le encuentro el error...

procedure TForm13.Modificar1Click(Sender: TObject);
begin
//buscar el id
adoquery2.Close;
adoquery2.SQL.Text:='select id from inventario where descripcion=:a and ubicacion=:b and fecha=:c';
adoquery2.Parameters.ParamByName('a').Value:=edit2.Text;
adoquery2.Parameters.ParamByName('b').Value:=edit3.Text;
adoquery2.Parameters.ParamByName('c').Value:=edit6.Text;
adoquery2.Open;

//modificar
adoquery3.Close;
adoquery3.SQL.Text:='SELECT id, descripcion, ubicacion, cuit_proveedor, numero_de_factura, fecha FROM inventario where id=:a';
adoquery3.Parameters.ParamByName('a').Value:=adoquery2.fields[0].asString;
adoquery3.Open;
adoquery3.Edit;
adoquery3.Fields[1].AsString:=edit2.Text;
adoquery3.Fields[2].AsString:=edit3.Text;
adoquery3.Fields[3].AsString:=edit4.Text;
adoquery3.Fields[4].AsString:=edit5.Text;
adoquery3.Fields[5].AsString:=datetostr(date)+' '+timetostr(time);
adoquery3.Post;

//edit1 es autonumerico

edit1.Text:='El sistema lo ingresa';
edit2.Clear;
edit3.Clear;
edit4.Clear;
edit5.Clear;
edit6.text:='El sistema lo ingresa';

//refresh
memo1.Text:='Recuerde que el "Libro de Inventario" debe ser actualizado manualmente y con letra manuscrita';
adoquery1.Close;
adoquery1.SQL.Text:='select inventario.id, inventario.descripcion, inventario.ubicacion, inventario.CUIT_PROVEEDOR, inventario.fecha, numero_de_factura from inventario';
adoquery1.Open;
dbgrid1.Columns[0].Title.caption:='Codigo de Inventario';
dbgrid1.Columns[1].Title.caption:='Descripcion';
//las ubicaciones tendrian que ser fk
dbgrid1.Columns[2].Title.caption:='Ubicación';
//los proveedores tendrian que ser fk
dbgrid1.Columns[3].Title.caption:='Proveedor';
dbgrid1.Columns[4].Title.caption:='Fecha';
dbgrid1.Columns[5].Title.caption:='Numero de factura';
dbgrid1.Columns[0].Width:=95;
dbgrid1.Columns[1].Width:=95;
dbgrid1.Columns[2].Width:=95;
dbgrid1.Columns[3].Width:=95;
dbgrid1.Columns[4].Width:=95;
dbgrid1.Columns[5].Width:=95;

end;
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder