Mysql recover values usaing field names

Post Reply
User avatar
PAUL SIMM
Posts: 86
Joined: Fri Oct 07, 2005 7:59 am
Location: Madrid, Spain
Contact:

Mysql recover values usaing field names

Post by PAUL SIMM »

How can I recover values from a SELECT using the field name and not its position in th array?

oCn :=maria_Connect( cHost,cUser,cDb,cPwd )

IF oCn=NIL
msgwait("Error conectando con eventos en la nube","")
return nil
ENDIF

cQwery:="SELECT * FROM proforma"
oRs := oCn:RowSet( cQwery)
MSGINFO(oRs:FieldGet(5)) //WORKS SHOWS CONTENT OF 1ST FIELD DESCRIP
MSGINFO(oRs:FieldName("DESCRIP")) //DOSE NOT WORK

oCn:Close()

RETURN NIL
****************************************************************************************
/*
CREATE TABLE `proforma` (
`UPDATED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ID` int(6) NOT NULL AUTO_INCREMENT,
`NO_PEDIDO` int(13) DEFAULT NULL,
`UNIDADES` int(4) DEFAULT NULL,
`DESCRIP` varchar(50) DEFAULT NULL,
`VAL_UNI` float(9,2) DEFAULT NULL,
`VAL_TOT` float(9,2) DEFAULT NULL,
`DIVISA` varchar(3) DEFAULT NULL,
`FECHA` date DEFAULT NULL,
`CATEGORIA` int(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=62706502 DEFAULT CHARSET=latin1;
*/
Regards/Saludos
Paul

paul@pes-systems.net
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Mysql recover values usaing field names

Post by nageswaragunupudi »

Code: Select all | Expand

? oRs:FieldGet( 5 )  // works
? oRs:DESCRIP  // works. Case not sensitive
? oRs:Fields( "DESCRIP" ):Value // works. Ado syntax compatible
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
PAUL SIMM
Posts: 86
Joined: Fri Oct 07, 2005 7:59 am
Location: Madrid, Spain
Contact:

Re: Mysql recover values usaing field names

Post by PAUL SIMM »

I found oRs:DESCRIP Works
Regards/Saludos
Paul

paul@pes-systems.net
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Mysql recover values usaing field names

Post by nageswaragunupudi »

for modifying and editing you can use:

Code: Select all | Expand

oRs:descript := cNewValue
oRs:fetcha := date()
// .....
oRs:Save()
Regards

G. N. Rao.
Hyderabad, India
Post Reply