Llevo varios días y no encuentro la razón, Por qué en el siguiente código me tira error cuando la tabla esta vacía?
solo cuando la tabla esta vacíia, si hay registros todo va bien.
- Code: Select all Expand view RUN
FW_ReOpenRecordSet(oRsHdr,oApp:oCon,"SELECT " +;
"H.*," +;
"P.PRO_NOM," +;
"P.PRO_EMA " +;
"FROM " +;
"HdrOdc H " +;
"LEFT JOIN " +;
"Proveedores P " +;
"ON " +;
"H.HDR_PRV = P.PRO_NUM " +;
"WHERE " +;
"YEAR(H.HDR_FDE) = '" + STR(nAmo,4,0) + "' " +;
"ORDER BY " +;
"H.HDR_ODC",adLockOptimistic,adOpenDynamic,0)
Con navicat reviso la tabla cuando esta vacía y me muestra un registro con todo los campos a NULL.
Esta es la estructura de la tabla, por si sirve de apoyo a su respuesta
- Code: Select all Expand view RUN
cCmdSql := "CREATE TABLE IF NOT EXISTS HdrOdc (" +;
"HDR_ODC DECIMAL(07,0) NOT NULL DEFAULT 0 COMMENT 'Número de orden de compra'," +;
"HDR_FDE DATE NULL COMMENT 'Fecha de emisión'," +;
"HDR_CAN BIT NOT NULL DEFAULT 0 COMMENT 'Cancelada ?'," +;
"HDR_DOL BIT NOT NULL DEFAULT 0 COMMENT 'Es en dólares ?'," +;
"HDR_TDC DECIMAL(09,5) NOT NULL DEFAULT 0.00000 COMMENT 'Tipo de cambio'," +;
"HDR_SUR BIT NOT NULL DEFAULT 0 COMMENT 'Ya esta surtida al 100% ?'," +;
"HDR_IMS BIT NOT NULL DEFAULT 0 COMMENT 'Imss, Infonavir e Impuestos'," +;
"HDR_TRA BIT NOT NULL DEFAULT 0 COMMENT 'Transporte'," +;
"HDR_VIA BIT NOT NULL DEFAULT 0 COMMENT 'Viaticos'," +;
"HDR_EQU BIT NOT NULL DEFAULT 0 COMMENT 'Equipo de seguridad'," +;
"HDR_NMN BIT NOT NULL DEFAULT 0 COMMENT 'Nóminas'," +;
"HDR_PRV DECIMAL(05,0) NOT NULL DEFAULT 0 COMMENT 'Número de proveedor'," +;
"HDR_PRO VARCHAR(11) NOT NULL DEFAULT '' COMMENT 'Proyecto'," +;
"HDR_CON VARCHAR(10) NOT NULL DEFAULT '' COMMENT 'Condiciones'," +;
"HDR_CDP VARCHAR(25) NOT NULL DEFAULT '' COMMENT 'Condiciones de pago'," +;
"HDR_SOL VARCHAR(30) NOT NULL DEFAULT '' COMMENT 'Solicitado por'," +;
"HDR_TOU DECIMAL(11,3) NOT NULL DEFAULT 0.000 COMMENT 'Total de unidades'," +;
"HDR_IMP DECIMAL(13,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe'," +;
"HDR_PDD DECIMAL(05,2) NOT NULL DEFAULT 0.00 COMMENT 'Porcentaje de descuento'," +;
"HDR_DSC DECIMAL(11,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe del descuento'," +;
"HDR_SUB DECIMAL(13,2) NOT NULL DEFAULT 0.00 COMMENT 'Sub total'," +;
"HDR_PDI DECIMAL(05,2) NOT NULL DEFAULT 0.00 COMMENT 'Porcentaje de I.V.A.'," +;
"HDR_IVA DECIMAL(11,2) NOT NULL DEFAULT 0.00 COMMENT 'I.V.A.'," +;
"HDR_NET DECIMAL(13,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe neto'," +;
"HDR_RIS DECIMAL(05,2) NOT NULL DEFAULT 0.00 COMMENT 'Porcentaje a retener por ISR'," +;
"HDR_IIS DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe de la retención por ISR'," +;
"HDR_RIV DECIMAL(05,2) NOT NULL DEFAULT 0.00 COMMENT 'Porcentaje a retener por IVA'," +;
"HDR_IIV DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe de la retención por IVA'," +;
"HDR_FLE DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe de la retención por FLETE'," +;
"HDR_TOT DECIMAL(13,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe total'," +;
"HDR_PAG DECIMAL(13,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe pagado al proveedor'," +;
"HDR_CYV DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Consumo y viaticos'," +;
"HDR_MDO DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Mano de obra'," +;
"HDR_ISS DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Imss'," +;
"HDR_EYH DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Equipo y herramienta'," +;
"HDR_IND DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT 'Indirectos y utilidad'," +;
"HDR_CAR DECIMAL(13,2) NOT NULL DEFAULT 0.00 COMMENT 'Importe cargado'," +;
"HDR_EEN TINYTEXT NULL COMMENT 'Entregar en..'," +;
"PRIMARY KEY(HDR_ODC))" +;
"ENGINE = InnoDB COMMENT 'Encabezado de ordenes de compra';"
Este es el error
- Code: Select all Expand view RUN
Application
===========
Path and name: D:\SapWin30\SapWin.Exe (32 bits)
Size: 5,303,296 bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 23.07
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows 11 64 Bits, version: 6.2, Build 9200
Time from start: 0 hours 0 mins 13 secs
Error occurred at: 01/03/2024, 13:15:50
Error description: (DOS Error -2147352567) WINOLE/1007 El valor de BOF o EOF es True, o el actual registro se eliminó; la operación solicitada requiere un registro actual. (0x800A0BCD): ADODB.Recordset
Stack Calls
===========
Called from: => TOLEAUTO:MOVEFIRST( 0 )
Called from: Source\SapWin3a.Prg => FILAMO( 440 )
Called from: Source\SapWin3a.Prg => (b)SAPWIN3A( 292 )
Called from: .\source\classes\TGET.PRG => TGET:__OPINC( 3313 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3369 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3379 )
Called from: .\source\classes\SCRLLBAR.PRG => (b)TSCROLLBAR( 57 )
Called from: .\source\classes\SCRLLBAR.PRG => TSCROLLBAR:GOUP( 0 )
Called from: .\source\classes\WINDOW.PRG => TGET:VSCROLL( 2473 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1857 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1306 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3693 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 307 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 449 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 24 )
Called from: => TOLEAUTO:MOVEFIRST( 0 )
Called from: Source\SapWin3a.Prg => FILAMO( 440 )
Called from: Source\SapWin3a.Prg => (b)SAPWIN3A( 292 )
Called from: .\source\classes\TGET.PRG => TGET:__OPINC( 3313 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3369 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3379 )
Called from: .\source\classes\SCRLLBAR.PRG => (b)TSCROLLBAR( 57 )
Called from: .\source\classes\SCRLLBAR.PRG => TSCROLLBAR:GOUP( 0 )
Called from: .\source\classes\WINDOW.PRG => TGET:VSCROLL( 2473 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1857 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1306 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3693 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 307 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 449 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 24 )
Called from: => TOLEAUTO:MOVEFIRST( 0 )
Called from: Source\SapWin3a.Prg => FILAMO( 440 )
Called from: Source\SapWin3a.Prg => (b)SAPWIN3A( 292 )
Called from: .\source\classes\TGET.PRG => TGET:__OPINC( 3313 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3369 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3379 )
Called from: .\source\classes\SCRLLBAR.PRG => (b)TSCROLLBAR( 57 )
Called from: .\source\classes\SCRLLBAR.PRG => TSCROLLBAR:GOUP( 0 )
Called from: .\source\classes\WINDOW.PRG => TGET:VSCROLL( 2473 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1857 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1306 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3693 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 307 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 449 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 24 )
Called from: => TOLEAUTO:MOVEFIRST( 0 )
Called from: Source\SapWin3a.Prg => FILAMO( 440 )
Called from: Source\SapWin3a.Prg => (b)SAPWIN3A( 292 )
Called from: .\source\classes\TGET.PRG => TGET:__OPINC( 3313 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3369 )
Called from: .\source\classes\TGET.PRG => (b)TGET_SPINNER( 3379 )
Called from: .\source\classes\SCRLLBAR.PRG => (b)TSCROLLBAR( 57 )
Called from: .\source\classes\SCRLLBAR.PRG => TSCROLLBAR:GOUP( 0 )
Called from: .\source\classes\WINDOW.PRG => TGET:VSCROLL( 2473 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1857 )
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT( 1306 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3693 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 307 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 449 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 24 )
Called from: => TOLEAUTO:MOVEFIRST( 0 )
Called from: Source\SapWin3a.Prg => FILAMO( 440 )
Called from: Source\SapWin3a.Prg => (b)SAPWIN3A( 292 )
Called from: .\source\classes\TGET.PRG => TGET:__OPINC( 3313 )
System
======
CPU type: AMD Ryzen 5 5500U with Radeon Graphics 2096 Mhz
Hardware memory: 15755 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %