Ver Mensaje Individual
  #4  
Antiguo 13-09-2007
Avatar de enecumene
[enecumene] enecumene is offline
Miembro de Oro
 
Registrado: may 2006
Ubicación: Santo Domingo, Rep. Dom.
Posts: 3.040
Reputación: 22
enecumene Va por buen camino
Hola Rudi, Buenas tardes, tu consejo no me funciono, lo estoy haciendo de esta manera, pues no me funciona, estoy seguro que estoy fallando, a ver:

Código Delphi [-]
procedure TFFactura.BitBtn1Click(Sender: TObject);
begin
if MessageDlg('¿Está seguro que desea Guardar?', mtConfirmation,
       [mbYes, mbNo], 0) = mrYes then
  begin
       if ZPedido.Fields[19].IsNull then <--Si el campo no tiene datos entonces:
        begin
        if ZFactura.State in [dsedit,dsinsert] then
        begin
        ZRegPed.SQL.Clear;
        ZRegPed.SQL.Add('UPDATE reg_pedidos SET oc_no_sigef_2='+Quotedstr('Sí')+', oc_no_sigef='+Quotedstr(DBEdit1.Text)+'');
        ZRegPed.SQL.Add(' WHERE no = '+Quotedstr(DBEdit15.Text)+' ');
        ShowMessage(ZRegPed.SQL.Text);
        ZRegPed.ExecSQL;
        ZFactura.Post;
        ZFactura.Insert;
        end else begin
       if not ZPedido.fields[19].IsNull then <--si el campo tiene datos entoces:
        begin
        if ZFactura.State in [dsedit,dsinsert] then
        begin
        ZRegPed.SQL.Clear;
        ZRegPed.SQL.Add('UPDATE reg_pedidos SET oc_no_sigef1='+Quotedstr(DBEdit1.Text)+'');
        ZRegPed.SQL.Add(' WHERE no = '+Quotedstr(DBEdit15.Text)+' ');
        ShowMessage(ZRegPed.SQL.Text);
        ZRegPed.ExecSQL;
        ZFactura.Post;
        ZFactura.Insert;
        end else begin
       if not ZPedido.Fields[42].IsNull then <--SI el campo anterior tiene datos entonces:
        begin
        if ZFactura.State in [dsedit,dsinsert] then
        begin
        ZRegPed.SQL.Clear;
        ZRegPed.SQL.Add('UPDATE reg_pedidos SET oc_no_sigef2='+Quotedstr(DBEdit1.Text)+'');
        ZRegPed.SQL.Add(' WHERE no = '+Quotedstr(DBEdit15.Text)+' ');
        ShowMessage(ZRegPed.SQL.Text);
        ZRegPed.ExecSQL;
        ZFactura.Post;
        ZFactura.Insert;
        end;
      end else
      showmessage('No hago nada, no estoy editando');
      end;
  end;
 end;
end;
end;
end;

se que hay una mejor manera de hacerlo, ojala me puedan ayudar .

Saludos.
__________________

Mi BLOG - ¡Joder, leanse la guia de estilo!
Las Palabras son enanas, los ejemplos gigantes.
Responder Con Cita