Ver Mensaje Individual
  #1  
Antiguo 14-03-2010
Avatar de tgsistemas
tgsistemas tgsistemas is offline
Miembro
 
Registrado: dic 2003
Ubicación: Barcelona
Posts: 149
Reputación: 23
tgsistemas Va por buen camino
TZQuery en tiempo de ejecucion....error

Hola a tod@s

basándome en una respuesta que he encontrado aquí, utilizo el siguiente código :
Código Delphi [-]
procedure TFInsertar.btnhayresultadosClick(Sender: TObject);
var
  MiQry : TZReadOnlyQuery;
  isql : string;
begin
  isql := 'select cdgo from tb03P where (centro = :centrotemp and fecha = :fechatemp);';
  try
    MiQry.Create(nil);
    MiQry.Connection := Data.ZConnectTGS;
    MiQry.SQL.Clear;
    MiQry.sql.Text := isql;
    MiQry.ParamByName('centrotemp').Asinteger := dbedtcentro.Field.Value;
    MiQry.ParamByName('fechatemp').AsDate := bdedtfecha.Date;
    MiQry.Open;

    if MiQry.RecordCount >0 then begin
      labAlerta.Visible := True;
      MessageDlg('No se permite Duplicar Datos en la Fecha Seleccionada, por favor revíselo... ', mtError, [mbOK], 0);
      bdedtfecha.SetFocus;
    end else begin
      labAlerta.Visible := False;
    end;
  finally
    MiQry.Close;
    MiQry.Free;
  end;
end;

pero al ejecutarlo me produce el siguiente error :
Código:
---------------------------
Debugger Exception Notification
---------------------------
Project GNATURCCOpe.exe raised exception class EAccessViolation with message 'Violación de acceso en la dirección 005997AE en módulo 'GNATURCCOpe.exe'. Leer de dirección 00000000'. 
Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------
el error se produce en MiQry.Create(nil) pero ahí me he atascado ya que no sé por qué se produce o quién lo provoca... obviamente a parte del que os escribe

P.D.: D7+MySql5.0+Zeos
__________________
Toni | blog
Responder Con Cita