Delphi - Delphi y EMS interbase

 
Vista:

Delphi y EMS interbase

Publicado por Gustavo (5 intervenciones) el 31/08/2009 01:13:35
Hola Foro:
Estoy desarrollando una aplicacion de Facturacion y no puedo grabar los datos desde un query

este seria el codigo que utilizo para pedir el contador ID de la Tabla Facturas.

with modulo.Query1 do
begin
Close;
SQL.Clear;
SQL.Add('Select MAX(COD_FAC_VTA) as COD_FAC_VTA from FAC_VTA');
Open;
iconsec:= FieldByName('COD_FAC_VTA').AsInteger+1;
Close;
end;

var fecha : TDateTime;
sfecha: String;
begin
fecha := StrToDateTime(EditFecha.Text);
DateTimeToString(sfecha, 'dd/mm/yyyy', fecha);
tabla factura...
with modulo.Query do
begin
close;
SQL.Clear;
SQL.Add('INSERT INTO FAC_VTA(COD_FAC_VTA, FECHA_VTA, HORA_VTA,COD_CLIENTE, COD_DEPOSITO,');
SQL.Add('COD_VENDEDOR, SUB_TOTAL, IVA_FAC_VTA, TOTAL_FAC_VTA, COMPROBANTE, TIPO_COMPROB, COND_VTA, COD_CON_IVA) Values ('); SQL.Add(''+inttostr(iconsec)+','+QuotedStr(sfecha)+','+QuotedStr(EditHora.Text)+','+QuotedStr(EditCo dCliente.Text)+','); SQL.Add(''+QuotedStr(EditDeposito.Text)+','+QuotedStr(EditCodVendedor.Text)+','+QuotedStr(Editsubtot al.Text)+','+QuotedStr(EditIvaFacVta.Text)+','); SQL.Add(''+QuotedStr(EditTotalGeneral.Text)+','+QuotedStr(EditNumComprobante.Text)+','+QuotedStr(Edi tTipoFac.Text)+','+QuotedStr(EditCondVta.Text)+','+QuotedStr(EditCondIVA. Text)+')'); ExecSQL; 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
sin imagen de perfil
Val: 65
Oro
Ha mantenido su posición en Delphi (en relación al último mes)
Gráfica de Delphi

RE:Delphi y EMS interbase

Publicado por E.T. (1244 intervenciones) el 31/08/2009 17:25:52
Si pudieras poner el error que te marca serí útil, pero viendolo así puedo notar que el formato de fecha que estás usando no es el correcto, debe ser mm/dd/yyyy

with modulo.Query1 do
begin
Close;
SQL.Clear;
SQL.Add('Select MAX(COD_FAC_VTA)+1 as COD_FAC_VTA from FAC_VTA');
Open;
iconsec:= FieldByName('COD_FAC_VTA').AsInteger;
Close;
end;

var fecha : TDateTime;
sfecha: String;
begin
sfecha:=formatDateTime('mm/dd/yyyy', StrToDateTime(EditFecha.Text));

tabla factura...
with modulo.Query do
begin
close;
SQL.Clear;
SQL.Add('INSERT INTO FAC_VTA(COD_FAC_VTA, FECHA_VTA, HORA_VTA,COD_CLIENTE, COD_DEPOSITO,');
SQL.Add('COD_VENDEDOR, SUB_TOTAL, IVA_FAC_VTA, TOTAL_FAC_VTA, COMPROBANTE, TIPO_COMPROB, COND_VTA, COD_CON_IVA) Values ('); SQL.Add(''+inttostr(iconsec)+','+QuotedStr(sfecha)+','+QuotedStr(EditHora.Text)+',' +QuotedStr(EditCodCliente.Text)+','); SQL.Add(''+QuotedStr(EditDeposito.Text)+','+QuotedStr(EditCodVendedor.Text)+',' +QuotedStr(Editsubtot al.Text)+','+QuotedStr(EditIvaFacVta.Text)+','); SQL.Add(''+QuotedStr(EditTotalGeneral.Text)+','+ QuotedStr(EditNumComprobante.Text) +','+
QuotedStr(Edi tTipoFac.Text)+','+QuotedStr(EditCondVta.Text) +','+QuotedStr(EditCondIVA. Text)+')'); ExecSQL; end;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Delphi y EMS interbase

Publicado por Gustavo (5 intervenciones) el 31/08/2009 20:23:37
Si el error se me olvido ponerlo, si pongo el frmato " mm/dd/yyyy " me dice convercion error from String; y si lo pongo en el formato dd/mm/yyyy me dice lo mismo pero me pone la fecha convercion error from String '31/08/2009' -
la verdad ya no se que mas verificar el campo FECHA_VTA en la base de datos es de tipo DATE
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 65
Oro
Ha mantenido su posición en Delphi (en relación al último mes)
Gráfica de Delphi

RE:Delphi y EMS interbase

Publicado por E.T. (1244 intervenciones) el 31/08/2009 23:32:17
Cuando te da el error, cuando intentas convertir la fecha o cuando ejecutas el query??
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Delphi y EMS interbase

Publicado por Gustavo (5 intervenciones) el 31/08/2009 23:39:47
Cuando Ejecuto el Query me da ese error de convercion
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 65
Oro
Ha mantenido su posición en Delphi (en relación al último mes)
Gráfica de Delphi

RE:Delphi y EMS interbase

Publicado por E.T. (1244 intervenciones) el 02/09/2009 17:43:36
Puede que tambien sea el campo se hora, prueba mandar null a la hora, y manda la fecha con los dos formatos de fecha que hemos visto para ver cual es el correcto
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar