get result field VALUE of a query Exec

Post

Posted
Rating:
#1 (In Topic #1270)
Regular
sergioabreu is in the usergroup ‘Regular’
 The documentation of mysql  for gambas has too few examples.

I know how to get the value of a FIELD in mysql RESULT  with the sintax result + exclamation + fieldname (res!nome for example)
But if we need to let the OBJECTS find the value, using array, index or the column name to get the CURSOR CURRENT VALUE without having to know the name?

I mean, in VB if I used  res.fields[0].value was the same of res!nome in gambas. BUT in gambas there is NOT VALUE or TEXT property. I am finding it difficult to retrieve something that should be simple.

If i print res.fields[0] or res.fields['nome'] I DO NOT get the value… but a FIELD object… can anyone help to AUTO DISCOVER field value without hardcoding the field names?
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
sergioabreu is in the usergroup ‘Regular’

SOLVED: get result field VALUE of query Exec

I will answer my own question, as I find out how to solve:

The syntax to get field value of the cursor in the RESULT  is :  the resultvar + [ fieldname ]  only.

I got stuck because I was using resultvar.fields object and to read the cursor is just resultvar[ fieldname ]

To find out fieldname of the FIRST column, for example, you should use the fields[0] property:  fieldname = resultvar.fields[0].name

SOLVED !
Online now: No Back to the top
1 guest and 0 members have just viewed this.