Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   SQL Error -404 (https://www.clubdelphi.com/foros/showthread.php?t=47019)

Radov3r 16-08-2007 11:59:33

SQL Error -404
 
Buenos días,
Estoy haciendo un programa que saca listados. Para ello, me he creado un componente RxMemoryData y me paso los datos suficientes para luego hacer una SQL y rellenarme el Registro con los datos.
Se me queda así:

Código Delphi [-]
R_ALBARAN : GSCAVENT;
begin   
  SERIE := QUERY.FIELDBYNAME('SERDOC').ASSTRING;
  NUMALBA := QUERY.FIELDBYNAME('NUMERO').ASINTEGER;
  FECLUG.CAPTION := R_PARAMETROS.FECHA_SISTEMA;
  NUMREF.CAPTION := COPY(R_PARAMETROS.FECHA_SISTEMA,9,2)+SERIE+INTTOSTR(NUMALBA);

  //Query para recuperar los datos del albarán
  Q_CAVENT := TQUERY.CREATE(NIL);
  Q_CAVENT.DATABASENAME := R_PARAMETROS.DBX_CONEXION.DATABASENAME;
  Q_CAVENT.CLOSE;
  Q_CAVENT.SQL.CLEAR;
  Q_CAVENT.SQL.ADD('SELECT GSCAVENT.* FROM GSCAVENT');
  Q_CAVENT.SQL.ADD('WHERE CODEMP = ' + INTTOSTR(R_PARAMETROS.EMPRESA));
  Q_CAVENT.SQL.ADD(' AND SERDOC = ' + QUOTEDSTR(SERIE));
  Q_CAVENT.SQL.ADD(' AND NUMERO = ' + INTTOSTR(NUMALBA));
  Q_CAVENT.OPEN;
  R_ALBARAN := CARGAR_GSCAVENT(Q_CAVENT);

El problema está que al hacer el OPEN me salta un error -404. La SQL es muy sencilla como para que haga esas cosas. Por cierto, he comprobado el SERIE y el NUMALBA y tienen valor.

¿Alguien puede echarme una mano? Gracias.

Neftali [Germán.Estévez] 16-08-2007 13:09:25

¿El error lo devuelve el servidor SQL o el componente?
¿Has ejecutado paso a paso para ver exactamente qué SQL se está lanzando?

Bicho 16-08-2007 13:13:00

Hola, si además indicases el motor de base de datos que usas, quizá podrías/mos buscar la info. referente a ese error.

Saludos

Radov3r 16-08-2007 13:21:01

Perdonad la falta de info.
Uso Delphi6, QReport e Informix.
El error salta al hacer el Q_CAVENT.OPEN y es el siguiente:

Project MNTCAVENT.exe raised exception class EDBEngineError with message 'General SQL error. Unknown error message number '-404'. Process stopped. Use Step or Run to continue.

El caso es que cuando le doy al OK para que se cierre el error me lleva al QuickRpt con la flecha señalando aquí:
Código Delphi [-]
 if PrintBand then
  begin
    if ForceNewPage and not PageBroken and
        not (BandType in [rbPageHeader, rbPageFooter, rbTitle, rbOverlay]) and (ParentReport.PageNumber > 0)
    then
    begin
      ParentReport.ForceNewPage;

Neftali [Germán.Estévez] 16-08-2007 13:48:09

Coloca un BreakPoint en ese línea y consulta:
Q_CAVENT.SQL.Text

a ver qué valor tiene, para descartar que sea un problema en la construcción de la SQL.
También puedes lanzar esa columna que obtengas directamente en el SQL Explorer a ver qué dice.

Radov3r 16-08-2007 14:02:24

He lanzado la sql en el explorer y sale lo que tiene que salir, o sea, que va bien.
He hecho lo del BreakPoint y me pone esto: Q_CAVENT.SQL.Text = 'SELECT * FROM GSCAVENT WHERE CODEMP = 1 AND SERDOC = 'AL' AND NUMERO = 2074079 AND NUMBAS = 0'#$D#$A
El NUMBAS sale porque lo he añadido yo (es para el índice de la tabla).

Radov3r 17-08-2007 15:16:19

¿Nadie sabe por qué me salta el error si la SQL está bien? Podría ser del Report, pero no entiendo demasiado de reports.


La franja horaria es GMT +2. Ahora son las 17:13:44.

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