Database Results
Posted
#1
(In Topic #1617)
Trainee
I'm a newcomer to Gambas, having been writing in numerous other languages for years, and I feel I'm doing really well in getting to grips with it.
But I've hit a brick wall with this one. I'm creating a simple database utility for personal use. In, for example, XOJO, you can either write rs.field("surname").stringvalue or rs.idxfield(1).stringvalue. In Gambas it looks at present that you can only use rs!surname. The stringvalue part isn't needed of course in Gambas.
Question: is there a Gambas equivalent of idxfield(0), eg, rs!(1)?
Help please!
Alan.
Posted
Administrator

You will have to clarify your question as I don't speak XOJO.CallMeAlan said
Hi,
I'm a newcomer to Gambas, having been writing in numerous other languages for years, and I feel I'm doing really well in getting to grips with it.
But I've hit a brick wall with this one. I'm creating a simple database utility for personal use. In, for example, XOJO, you can either write rs.field("surname").stringvalue or rs.idxfield(1).stringvalue. In Gambas it looks at present that you can only use rs!surname. The stringvalue part isn't needed of course in Gambas.
Question: is there a Gambas equivalent of idxfield(0), eg, rs!(1)?
Help please!
Alan.
Are you trying to address a field in a record by it's index, or something a like?
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Trainee
In XOJO we would say rsfield("surname").stringvalue, or rs.idxfield(1).stringvalue, which give the same value. This permits the use of a for loop to address the columns, such as:
for x=0 to whatever
listbox1.add(rs!x)
next
I hope this makes sense!
Alan.
Posted
Expert

So you simple can do
For example
So you have 3 choices:
1.) rs!Namen
2.) rs["Namen"]
3.) rs[1]
/comp/gb.db2/result - Gambas Documentation
best regards
Poly
Posted
Regular

Posted
Trainee
Many thanks for solving my problem.
Alan
1 guest and 0 members have just viewed this.

