Ver Mensaje Individual
  #1  
Antiguo 10-07-2007
Avatar de magnu9
magnu9 magnu9 is offline
Miembro
 
Registrado: nov 2006
Posts: 84
Reputación: 20
magnu9 Va por buen camino
Error No existe columna 'cod'

Un saludo a ver quien me da una mano... estoy trantando de hacer la entrada de usuario antes de acceder al sistema... lo intento con siguiente codigo. Utilizo SQL SERVER. Dicho codigo me da un error de que no existe la columna "cod" pues se lo tengo como parameters... aun asi me da el error.
En el string de mi adoquery coloco la siguiente sentencia "
SELECT codusu, nomusu, pasusu FROM Usuario where codusu=cod
"
Código Delphi [-]
procedure TFLogin.BtnOkClick(Sender: TObject);

begin
 
LoginOK :=False;
   AdoQuery1.Parameters.ParamByName('cod').Value:= Edit1.Text;
   AdoQuery1.Active:= True;
   If AdoQuery1.RecordCount < 1 then
    Begin
       Cuenta := Cuenta + 1;
       MessageDlg('Usuario no encontrado',mtError, [mbOK], 0);
       Edit1.Text := '';
       Edit2.Text := '';
       AdoQuery1.Active := False;
    If Cuenta = 3 then  Application.Terminate;
    end
   else
    If AdoQuery1pasusu.AsString = Edit2.Text then
        Begin
           LoginOk := True;
           Usuario := AdoQuery1codusu.AsString;
           Nombre := AdoQuery1nomusu.AsString;
           AdoQuery1.Active := False;
           Close;
        end
     else
         Begin
           Cuenta := Cuenta + 1;
           MessageDlg('Clave Inválida',mtError, [mbOK], 0);
           Edit2.Text := '';
           AdoQuery1.Active := False;
      If Cuenta = 3 then Application.Terminate;
         end;

end;
procedure TFLogin.BtnCancelClick(Sender: TObject);
begin
   LoginOK :=False;
   Application.Terminate;
end;
procedure TFLogin.FormCreate(Sender: TObject);
begin
     Cuenta := 0;
   Usuario := '';
   Nombre := '';
end;
Responder Con Cita