Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Conexión con bases de datos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Conexión con bases de datos

 
 
Herramientas Buscar en Tema Desplegado
  #9  
Antiguo 11-07-2007
Avatar de Onti
Onti Onti is offline
Miembro
 
Registrado: jul 2003
Ubicación: La Paz - Bolivia
Posts: 500
Poder: 24
Onti Va por buen camino
Algunos cambios sugeridos:

1.- Cambia tu Sql inicial por
Código SQL [-]
SELECT codusu, nomusu, pasusu FROM Usuario where codusu=:cod and PasUsu = :PasUsu"
2.- Valida si los "edits" están vacíos antes de realizar la consulta y mejor si utilizas la función "length"

3. Utiliza ParamByName para el pass
4. Utiliza la funcion Inc para incrementar tu contador

Código Delphi [-]
  // Verificar edit vacios
    If (Length(Edit1.text)+Length(Edit2.text))=0 then
      Begin
        MessageDlg('DIGITE LOS ESPACIO EN BLANCO',mtInformation,[mbCancel], 0,);
        Exit;
      End;

  // Inicializar variables
    LoginOK :=False;

  // Realizar consulta
    AdoQuery1.Close;
    AdoQuery1.Parameters.ParamByName('Cod').Value    := Edit1.Text;
    AdoQuery1.Parameters.ParamByName('PasUsu').Value := Edit2.Text;
    AdoQuery1.Open;
    If AdoQuery1.RecordCount =0 then
      Begin
        Inc(Cuenta);
        MessageDlg('Usuario no encontrado',mtError, [mbOK], 0);
        Edit1.Text := '';
        Edit2.Text := '';
      End
    Else
      LoginOk:=True;
    AdoQuery1.Close;
    If Cuenta = 3 then  
      Application.Terminate;

Última edición por Onti fecha: 11-07-2007 a las 21:20:24.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Hacer que una columna de un DbGrid aparezca distinta según valor Aprendiendo OOP 11 30-11-2018 14:47:20
Error en columna en Trigger brakaman Firebird e Interbase 2 13-06-2007 18:14:14
Error: componente ya existe Manuel Varios 4 22-08-2006 21:09:03
Error al añadir columna JorgeBec SQL 1 21-02-2004 02:51:44
Error "Ya existe un componente con el nombre QRStandarPreview" Jose Manuel Impresión 5 13-06-2003 07:55:26


La franja horaria es GMT +2. Ahora son las 16:51:44.


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