FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Una de fechas (SOLUCIONADO)
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Una de fechas (SOLUCIONADO)
Posted: Tue Jun 15, 2021 01:35 PM

Saludos al foro:

Tengo la siguiente situaci贸n, en un registro tengo dos campos de tipo fecha
definidos como DATE.

Uno de los campos contiene la fecha de emisi贸n, por lo tanto siempre tiene
una fecha, pero el otro que tiene la fecha de pago al momento de grabar
no tiene contenido, a煤n no se ha pagado, por lo tanto debe ir vac铆o.

Tengo definido el campo como NOT NULL y por DEFAULT '0000-00-00', sin
embargo al retomar el registro para mostrarlo en alg煤n consulta me tira
error por el campo vac铆o.

Alg煤n consejo?, que estoy haciendo mal?

Gracias

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Una de fechas
Posted: Tue Jun 15, 2021 01:45 PM

Ejemplo simples? Cual error te retorna? Muestre. Saludos.

Jo茫o Santos - S茫o Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Una de fechas
Posted: Tue Jun 15, 2021 10:30 PM
Karinha:

Gracias por el inter茅s, este es el error que me tira

Code (fw): Select all Collapse
Application
===========
聽 聽Path and name: C:\SiaMSM\SiaMsm.Exe (32 bits)
聽 聽Size: 5,007,872 bytes
聽 聽Compiler version: Harbour 3.2.0dev (r1904111533)
聽 聽FiveWin 聽version: FWH 19.05
聽 聽C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
聽 聽Windows version: 6.2, Build 9200 

聽 聽Time from start: 0 hours 0 mins 5 secs 
聽 聽Error occurred at: 15/06/2021, 17:20:47
聽 聽Error description: (DOS Error -2147352567) WINOLE/1007 聽El proveedor de datos u otro servicio devolvi贸 un estado E_FAIL. (0x80004005): Microsoft Cursor Engine

Stack Calls
===========
聽 聽Called from: 聽=> TOLEAUTO:BOF( 0 )
聽 聽Called from: Source\SiaMsm6c.Prg => LEEDET( 1304 )
聽 聽Called from: Source\SiaMsm6c.Prg => IMPRIMIR( 1213 )
聽 聽Called from: Source\SiaMsm6c.Prg => (b)LABARRA( 266 )
聽 聽Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 697 )
聽 聽Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 983 )
聽 聽Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
聽 聽Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2006 )
聽 聽Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
聽 聽Called from: 聽=> WINRUN( 0 )
聽 聽Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1078 )
聽 聽Called from: Source\SiaMsm.Prg => MAIN( 171 )


Y esta es la definici贸n de los campos en la tabla

Code (fw): Select all Collapse
聽 聽 cCmdSql聽:= "CREATE TABLE IF NOT EXISTS DetOdc (" +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_FOL DECIMAL(07,0)聽 NOT NULL聽 聽 DEFAULT 0 聽 聽 聽 聽 聽 聽 COMMENT 'Folio de la 贸rden de compra'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_PTD DECIMAL(05,0)聽 NOT NULL聽 聽 DEFAULT 0 聽 聽 聽 聽 聽 聽 COMMENT 'Partida'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_PAR DECIMAL(05,0)聽 NOT NULL聽 聽 DEFAULT 0 聽 聽 聽 聽 聽 聽 聽 COMMENT 'N煤mero de parte'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_POS TEXT聽 聽聽 聽 聽 聽 聽 聽 NOT NULL聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 COMMENT 'Producto o servicio solicitado'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_CTD DECIMAL(09,3)聽 NOT NULL聽 聽 DEFAULT 0.000聽 聽 聽 聽 聽COMMENT 'Cantidad'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_UDM VARCHAR(03)聽 聽 聽 聽 NOT NULL聽 聽 DEFAULT ''聽 聽 聽 聽 聽 聽 COMMENT 'Unidad de medida'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_APL TEXT聽 聽聽 聽 聽 聽 聽 聽 NOT NULL聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 COMMENT 'Aplicaci贸n'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_UNI DECIMAL(09,2)聽 NOT NULL聽 聽 DEFAULT 0.000聽 聽 聽 聽 聽COMMENT 'Precio unitario'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_IMP DECIMAL(09,2)聽 NOT NULL聽 聽 DEFAULT 0.000聽 聽 聽 聽 聽COMMENT 'Importe'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_FDE DATE聽 聽 聽 聽 聽 聽 聽 聽 NOT NULL聽 聽 DEFAULT '0000-00-00'聽 聽 COMMENT 'Fecha de la entrada'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "DET_ENT DECIMAL(09,3)聽 NOT NULL聽 聽 DEFAULT 0.000聽 聽 聽 聽 聽COMMENT 'Cantidad entregada'," +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "PRIMARY KEY(DET_FOL,DET_PTD))" +;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "ENGINE = InnoDB 聽 聽聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 COMMENT 'Detalle de 贸rdenes de compra';"


El problema esta en el campo DET_FDE, al grabar esta vacio, con el valor por DEFAULT '0000-00-00' como
se ve en el siguiente texto, que al leerlo para imprimir es cuando tira el error

1 1 1 PRIMERA REFACCION 5000 PZS Almac茅n de refacciones 1.5 7500 0000-00-00 0

Espero haber explicado bien el problema

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: Una de fechas (SOLUCIONADO)
Posted: Wed Jun 16, 2021 07:48 PM

Armando buenas tardes como estas?

Como lo solucionaste?

Saludos
LEANDRO AREVALO
Bogot谩 (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Una de fechas (SOLUCIONADO)
Posted: Wed Jun 16, 2021 08:56 PM
Hola Leandro:

Ah铆 va la soluci贸n para evitar muchos dolores de cabeza.

Tenia yo definida la estructura de una factura en el campo D02_FECPAG de la siguiente manera

Code (fw): Select all Collapse
"D02_FECPAG DATE 聽 聽 聽 聽 聽 聽 NOT 聽NULL 聽DEFAULT '0000-00-00' 聽COMMENT 'Fecha del pago'," +;


Obviamente cuando registraba yo la factura a煤n no exist铆a una fecha de pago, el valor que
se grababa era el valor por deault 0000-00-00 por lo que cuando consultaba el registro me
tiraba el espantoso error antes mencionado.

La soluci贸n es simple, se debe definir el campo como NULL y sin valor por DEFAULT

Code (fw): Select all Collapse
"D02_FECPAG DATE 聽 聽 聽 聽 聽 聽聽 聽 聽 聽聽NULL 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽COMMENT 'Fecha del pago'," +;


Entonces cuando se graba el registro, el campo queda como NULL, de esta manera al hacer
la consulta ya no tira el error, solo debemos validar que el contenido no sea NULL cuando
hagamos uso del campo D02_FECPAG.

Espero quitar dolores de cabeza.

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: Una de fechas (SOLUCIONADO)
Posted: Wed Jun 16, 2021 09:13 PM

Que bueno que lo hayas solucionado.

Muchas gracias por la informaci贸n. :D

Saludos
LEANDRO AREVALO
Bogot谩 (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]

Continue the discussion