Ver Mensaje Individual
  #12  
Antiguo 06-01-2008
LENOCB LENOCB is offline
Miembro
 
Registrado: dic 2008
Ubicación: Argentina
Posts: 54
Reputación: 17
LENOCB Va por buen camino
Hola, de nuevo, ahora me salta un error ,acá pongo el codigo para que vean:

Código Delphi [-]procedure TFormGrupos.BitBtn1Click(Sender: TObject); //Agrega un Grupo sino está en la Tabla TGrupos.
Var agregar:String;
CO:Integer;
begin //Primero Buscar el Registro para ver si está . Y verifica tambien el codigo
FormGrupos.ADOQuery1.Active := False;
FormGrupos.ADOQuery1.SQL.Text := 'Select Nombre From TGrupos WHERE Nombre = :Nombre';
FormGrupos.ADOQuery1.Parameters.Parambyname('Nombre').Value:= Edit1.Text;
FormGrupos.ADOQuery1.Active := True;
If Edit1.Text = FormGrupos.ADOQuery1.Fields[0].Value then begin MessageDlg('El Grupo : '+Edit1.Text+' ya Existe ',mtError,[mbOK],0);
Edit1.text:='';
Edit1.SetFocus;
end else begin //Ahora me fijo el Código si ya existe.
//FormGrupos.ADOQuery1.SQL.Clear;
FormGrupos.ADOQuery1.Active := False;
FormGrupos.ADOQuery1.SQL.Text:= 'Select Cod_G TGrupos From TGrupos Where Cod_G = :Cod_G';
FormGrupos.ADOQuery1.Parameters.Parambyname('Cod_G').Value:= StrToInt(Edit2.Text);
FormGrupos.ADOQuery1.Active:=true;
If (StrToInt(Edit2.Text)) = FormGrupos.ADOQuery1.Fields[0].Value Then begin MessageDlg('El Código: '+Edit2.Text+', ya existe', mtError,[mbOk],0); Edit2.Text:='';
Edit2.SetFocus;
end else //Esta todo bien entonces agrego.
begin FormGrupos.ADOQuery1.Active := False; FormGrupos.ADOQuery1.SQL.Text:= 'Insert Into TGrupos (Nombre, Cod_G) Values (:Nombre, :Codigo)';
FormGrupos.ADOQuery1.Parameters.Parambyname('Nombre').Value:= Edit1.Text;
FormGrupos.ADOQuery1.Parameters.Parambyname('Codigo').Value:= StrToInt(Edit2.Text);
FormGrupos.ADOQuery1.ExecSQL;
end;
end;


y lo que esta en verde ,me tira error :"Error de sintaxis (falta operador) en la expresion de cunsulta Cod_G TGrupos"
Responder Con Cita