Ver Mensaje Individual
  #15  
Antiguo 15-07-2015
Avatar de olbeup
olbeup olbeup is offline
Miembro
 
Registrado: jul 2005
Ubicación: Santiago de la Ribera (España)
Posts: 685
Reputación: 19
olbeup Va camino a la fama
Código Delphi [-]
 { TFormX Private Declarations } 
  Tabla_Registro_Historico_Ventas: TADOQuery;

..
procedure HacerAlgoConLaTabla;
begin
  // esto es realmente tedioso
  if not(Tabla_Registro_Historico_Ventas.Active) then
    Tabla_Registro_Historico_Ventas.Open;

  Tabla_Registro_Historico_Ventas.Edit;
  Tabla_Registro_Historico_Ventas.FieldByName('Apellidos_Y_Nombres_Cliente').AsString := 
                                               Tabla_Registro_Historico_Ventas.FieldByName('Apellido').AsString + ', ' + 
                                               Tabla_Registro_Historico_Ventas.FieldByName('Nombres').AsString
  Tabla_Registro_Historico_Ventas.Post;
end;

procedure OtraForma;
begin
  // esto también puede ser
  with Tabla_Registro_Historico_Ventas do
  begin
    if (not Active) then
      Open;

    Edit;

    FieldByName('Apellidos_Y_Nombres_Cliente').AsString :=
      FieldByName('Apellido').AsString + ', ' + 
      FieldByName('Nombres').AsString;

    Post;
  end;
end;

procedure OtraMas;
var
  FadoCnn: TADOConnection;
begin
  FadoCnn := TADOConnection.Create(nil);
    FadoCnn.LoginPrompt := False;
    FadoCnn.ConnectionString := ;

  with TADOQuery.Create(nil) do
  begin
    Connection := FadoCnn;

    SQL.Add('SELECT');
    SQL.Add('    Apellidos_Y_Nombres_Cliente');
    SQL.Add('    ,Apellido');
    SQL.Add('    ,Nombres');
    SQL.Add('  FROM Clientes');

    Open;
    
    Edit;

    FieldByName('Apellidos_Y_Nombres_Cliente').AsString :=
      FieldByName('Apellido').AsString + ', ' + 
      FieldByName('Nombres').AsString;

    Post;

    FadoCnn.Free;
    Free;
  end;
end;

Para gustos los colores.

Un saludo.
__________________
Al hacer una consulta SQL, haz que los demás te entiendan y disfruten de ella, será tú reflejo de tú saber.
Responder Con Cita