Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Buscar Registros En Firebird (https://www.clubdelphi.com/foros/showthread.php?t=66951)

bothy 22-03-2010 07:14:57

Buscar Registros En Firebird
 
Hola
A Qui De Nuevo Ocupando De Su Ayuda .
Tengo Una Base De Datos En Firebird E Ibexpert Llamada Bdusuarios Y Tengo Una Tabla Llamada Usuaios Con Tres Atributos Clave,nombre,domicilio.tambien Tengo Un Form Con Sus Respectivos Edit.quisiera Saber Como Es El Codigo Para Que Me Busque Un Registro Dando La Clave En Un Edit Y Pulsando Un Button Para Que Me Muestre El Nombre Y El Domicilio Del Usuario En Los Demas Edit.
:dgracias De Nuevo..

Caral 22-03-2010 12:49:57

Hola
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
Query1.sql.text:= 'Select Clave,nombre,domicilio from Usuarios where Clave =:Cla';
Query1.Parameters[0].Value:= Edit1.Text;
Query1.Open;
Edit2.text:= Query1.filebyname('nombre').AsString;
Edit3.text:= Query1.filebyname('domicilio').AsString;
end;
Saludos

bothy 22-03-2010 19:27:32

Hola De Nuevo Caral
Muchas Gracias Por La Ayuda
Pero Te Queria Preguntar Si No Es Mucha Molestia.
¿ Como Remplazo Ese Codigo Para Ponerle Una Condicion Que Si No Existe La Clave Mande Un Mensage Que No Encontro La Clave?
Mucha Gracias Caral Por La Ayuda..

Caral 22-03-2010 19:52:30

Hola
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
Query1.sql.text:= 'Select Clave,nombre,domicilio from Usuarios where Clave =:Cla';
Query1.Parameters[0].Value:= Edit1.Text;
Query1.Open;
If Query1.FilebyName('Clave').AsString = Edit1.Text then
Begin
Edit2.text:= Query1.filebyname('nombre').AsString;
Edit3.text:= Query1.filebyname('domicilio').AsString;
end
else
MessageDlg('Clave Inválida',mtError, [mbOK], 0);
Edit1.Text := '';
Edit1.SetFocus;
Query1.Active := False;
end;
Saludos

maeyanes 22-03-2010 20:53:26

Hola...

Yo lo haría así:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
  Query1.sql.text:= 'Select Clave,nombre,domicilio from Usuarios where Clave = :Cla';
  Query1.Parameters[0].Value := Edit1.Text;
  Query1.Open;
  if not Query1.IsEmpty then
  begin
    Edit2.text:= Query1.filebyname('nombre').AsString;
    Edit3.text:= Query1.filebyname('domicilio').AsString
  end
  else
  begin
    MessageDlg('Clave Inválida',mtError, [mbOK], 0);
    Edit1.Text := '';
    Edit1.SetFocus
  end;
  Query1.Active := False;
end;

bothy 22-03-2010 22:48:08

Hola nuevo
caral
hola de nuevo maeyanes
gracias por su ayuda me sirvio de mucho.
ahora si no es mucha molestia les pregunto
yo uso TIBDatabase y TIBTransaction para poder enlazar la BD Firebird el problema es que nomas se de esos componentes para enlazar firebird
quisiera saber cules otros componentes tambien sirven para enlazar firebird.
mucha gracias por su ayuda..:)

Caro 23-03-2010 03:55:21

Cita:

Empezado por bothy (Mensaje 357843)
...........ahora si no es mucha molestia les pregunto
yo uso TIBDatabase y TIBTransaction para poder enlazar la BD Firebird el problema es que nomas se de esos componentes para enlazar firebird
quisiera saber cules otros componentes tambien sirven para enlazar firebird.
mucha gracias por su ayuda..:)

Hola bothy, puedes utilizar los componentes dbExpress, Ado(ODBC), creo que también Zeos ....

Saluditos

bothy 23-03-2010 05:37:37

Hola caro
muchas gracias por la ayuda.
dbexpress me parese perfecto
gracias colegas por su ayuda...:D


La franja horaria es GMT +2. Ahora son las 05:13:48.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi