In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Usage of TDataSet
-
- Mensajes: 133
- Registrado: Dom Dic 27, 2009 9:54 am
Usage of TDataSet
I am using MariaDB Data Source.
My following code do not work and gives me error at cName Property assignment.
WITH OBJECT oTable := TDataSet():Create()
:oDataSource := AppData:oDS
:cName := 'exppcinv'
:lOpen := .T.
aTabFields := oTable:aFields
:lOpen := .F.
END WITH
What am I doing wrong ?
TIA
Milan.
My following code do not work and gives me error at cName Property assignment.
WITH OBJECT oTable := TDataSet():Create()
:oDataSource := AppData:oDS
:cName := 'exppcinv'
:lOpen := .T.
aTabFields := oTable:aFields
:lOpen := .F.
END WITH
What am I doing wrong ?
TIA
Milan.
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: Usage of TDataSet
Hello,
Please send at least the error.log. TIA.
Regards,
Note: Use TSqlQuery or TSqlTable instead of TDataset
Please send at least the error.log. TIA.
Regards,
Note: Use TSqlQuery or TSqlTable instead of TDataset
-
- Mensajes: 133
- Registrado: Dom Dic 27, 2009 9:54 am
Re: Usage of TDataSet
Ok. I tried following code. However it always returns lPrimaryKey as .F. even in case of Primary Key field. I use MariaDB database.
WITH OBJECT oTable := TSqlTable():Create()
:oDataSource := AppData:oDS
:cTableName := 'exppcinv'
:lOpen := .T.
aTabFields := oTable:aFields
END WITH
FOR i = 1 TO Len(aTabFields)
MsgInfo (HB_ValToExp(aTabFields:cName) + ':' + HB_ValToExp(aTabFields:lPrimaryKey))
NEXT
Kindly guide.
TIA
Milan.
WITH OBJECT oTable := TSqlTable():Create()
:oDataSource := AppData:oDS
:cTableName := 'exppcinv'
:lOpen := .T.
aTabFields := oTable:aFields
END WITH
FOR i = 1 TO Len(aTabFields)
MsgInfo (HB_ValToExp(aTabFields:cName) + ':' + HB_ValToExp(aTabFields:lPrimaryKey))
NEXT
Kindly guide.
TIA
Milan.
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: Usage of TDataSet
Please send the table definition (DDL). TIA.
Regards,
Regards,
-
- Mensajes: 133
- Registrado: Dom Dic 27, 2009 9:54 am
Re: Usage of TDataSet
Here is DDL :
CREATE TABLE `exppcinv` (
`exppcinvbook` CHAR(2) NOT NULL,
`exppcinvexunitcode` SMALLINT(5) UNSIGNED NOT NULL,
`exppcinvvno` SMALLINT(5) UNSIGNED NOT NULL,
`vdate` DATE NOT NULL,
`party` SMALLINT(5) UNSIGNED NULL DEFAULT NULL,
`buyer` SMALLINT(5) UNSIGNED NULL DEFAULT NULL,
`buyerlcno` VARCHAR(50) NULL DEFAULT NULL,
`lcissuedt` DATE NULL DEFAULT NULL,
`lcbank` VARCHAR(50) NULL DEFAULT NULL,
`availrem` VARCHAR(500) NULL DEFAULT NULL,
`containerrem` VARCHAR(500) NULL DEFAULT NULL,
`deliveryterms` VARCHAR(50) NULL DEFAULT NULL,
`payterms` VARCHAR(50) NULL DEFAULT NULL,
`destination` VARCHAR(50) NULL DEFAULT NULL,
`carriage` VARCHAR(50) NULL DEFAULT NULL,
`receipt` VARCHAR(50) NULL DEFAULT NULL,
`transporter` VARCHAR(50) NULL DEFAULT NULL,
`discharge` VARCHAR(50) NULL DEFAULT NULL,
`lading` VARCHAR(50) NULL DEFAULT NULL,
`finaldestination` VARCHAR(50) NULL DEFAULT NULL,
`amount` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`frghtamt` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`billamt` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`noofpallets` SMALLINT(5) NOT NULL DEFAULT '0',
`palletswt` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`remarks` VARCHAR(500) NULL DEFAULT NULL,
`entryuser` SMALLINT(5) UNSIGNED NOT NULL,
`edituser` SMALLINT(5) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`exppcinvbook`, `exppcinvexunitcode`, `exppcinvvno`),
INDEX `FK_exppcinv_exunit` (`exppcinvexunitcode`),
INDEX `FK_exppcinv_user` (`entryuser`),
INDEX `FK_exppcinv_user_2` (`edituser`),
INDEX `FK_exppcinv_acmast` (`party`),
INDEX `FK_exppcinv_acmast_2` (`buyer`),
CONSTRAINT `FK_exppcinv_acmast` FOREIGN KEY (`party`) REFERENCES `acmast` (`accode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_acmast_2` FOREIGN KEY (`buyer`) REFERENCES `acmast` (`accode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_exunit` FOREIGN KEY (`exppcinvexunitcode`) REFERENCES `exunit` (`exunitcode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_user` FOREIGN KEY (`entryuser`) REFERENCES `user` (`usercode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_user_2` FOREIGN KEY (`edituser`) REFERENCES `user` (`usercode`) ON UPDATE CASCADE
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
CREATE TABLE `exppcinv` (
`exppcinvbook` CHAR(2) NOT NULL,
`exppcinvexunitcode` SMALLINT(5) UNSIGNED NOT NULL,
`exppcinvvno` SMALLINT(5) UNSIGNED NOT NULL,
`vdate` DATE NOT NULL,
`party` SMALLINT(5) UNSIGNED NULL DEFAULT NULL,
`buyer` SMALLINT(5) UNSIGNED NULL DEFAULT NULL,
`buyerlcno` VARCHAR(50) NULL DEFAULT NULL,
`lcissuedt` DATE NULL DEFAULT NULL,
`lcbank` VARCHAR(50) NULL DEFAULT NULL,
`availrem` VARCHAR(500) NULL DEFAULT NULL,
`containerrem` VARCHAR(500) NULL DEFAULT NULL,
`deliveryterms` VARCHAR(50) NULL DEFAULT NULL,
`payterms` VARCHAR(50) NULL DEFAULT NULL,
`destination` VARCHAR(50) NULL DEFAULT NULL,
`carriage` VARCHAR(50) NULL DEFAULT NULL,
`receipt` VARCHAR(50) NULL DEFAULT NULL,
`transporter` VARCHAR(50) NULL DEFAULT NULL,
`discharge` VARCHAR(50) NULL DEFAULT NULL,
`lading` VARCHAR(50) NULL DEFAULT NULL,
`finaldestination` VARCHAR(50) NULL DEFAULT NULL,
`amount` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`frghtamt` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`billamt` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`noofpallets` SMALLINT(5) NOT NULL DEFAULT '0',
`palletswt` DECIMAL(12,2) NOT NULL DEFAULT '0.00',
`remarks` VARCHAR(500) NULL DEFAULT NULL,
`entryuser` SMALLINT(5) UNSIGNED NOT NULL,
`edituser` SMALLINT(5) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`exppcinvbook`, `exppcinvexunitcode`, `exppcinvvno`),
INDEX `FK_exppcinv_exunit` (`exppcinvexunitcode`),
INDEX `FK_exppcinv_user` (`entryuser`),
INDEX `FK_exppcinv_user_2` (`edituser`),
INDEX `FK_exppcinv_acmast` (`party`),
INDEX `FK_exppcinv_acmast_2` (`buyer`),
CONSTRAINT `FK_exppcinv_acmast` FOREIGN KEY (`party`) REFERENCES `acmast` (`accode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_acmast_2` FOREIGN KEY (`buyer`) REFERENCES `acmast` (`accode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_exunit` FOREIGN KEY (`exppcinvexunitcode`) REFERENCES `exunit` (`exunitcode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_user` FOREIGN KEY (`entryuser`) REFERENCES `user` (`usercode`) ON UPDATE CASCADE,
CONSTRAINT `FK_exppcinv_user_2` FOREIGN KEY (`edituser`) REFERENCES `user` (`usercode`) ON UPDATE CASCADE
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: Usage of TDataSet
Tested and working correctly. This is the code used:
And this is the output:
#1: exppcinvbook .T.
#2: exppcinvexunitcode .T.
#3: exppcinvvno .T.
#4: vdate .F.
#5: party .F.
#6: buyer .F.
#7: buyerlcno .F.
#8: lcissuedt .F.
#9: lcbank .F.
#10: availrem .F.
#11: containerrem .F.
#12: deliveryterms .F.
#13: payterms .F.
#14: destination .F.
#15: carriage .F.
#16: receipt .F.
#17: transporter .F.
#18: discharge .F.
#19: lading .F.
#20: finaldestination .F.
#21: amount .F.
#22: frghtamt .F.
#23: billamt .F.
#24: noofpallets .F.
#25: palletswt .F.
#26: remarks .F.
#27: entryuser .F.
#28: edituser .F.
I attach the project.
Regards,
Código: Seleccionar todo
LOCAL oField AS CLASS TDataField
FOR EACH oField IN ::oSQLTable1:aFields
LogDebug( oField:cName, oField:lPrimaryKey )
NEXT
#1: exppcinvbook .T.
#2: exppcinvexunitcode .T.
#3: exppcinvvno .T.
#4: vdate .F.
#5: party .F.
#6: buyer .F.
#7: buyerlcno .F.
#8: lcissuedt .F.
#9: lcbank .F.
#10: availrem .F.
#11: containerrem .F.
#12: deliveryterms .F.
#13: payterms .F.
#14: destination .F.
#15: carriage .F.
#16: receipt .F.
#17: transporter .F.
#18: discharge .F.
#19: lading .F.
#20: finaldestination .F.
#21: amount .F.
#22: frghtamt .F.
#23: billamt .F.
#24: noofpallets .F.
#25: palletswt .F.
#26: remarks .F.
#27: entryuser .F.
#28: edituser .F.
I attach the project.
Regards,
- Adjuntos
-
- mysql.zip
- (2.25 KiB) Descargado 209 veces
-
- Mensajes: 133
- Registrado: Dom Dic 27, 2009 9:54 am
Re: Usage of TDataSet
I tested your project. But it still do not show Primary Keys.
My Xailer is 4.0.2 (June 2015).
Should I check anything else ?
TIA
Milan.
My Xailer is 4.0.2 (June 2015).
Should I check anything else ?
TIA
Milan.
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: Usage of TDataSet
Send mi your project and I send you the EXE file.
Regards,
Regards,