On Wed, 17 May 2017, PICCORO McKAY Lenz wrote: > i try to filla gridview at demand, so due ODBC limitations i cannot count > so inside my bean-like object i count and tehen return properties.. > > the problem goes when i try to move to the fitrs record, i implement the > code in wrong way? : > > Try resulobj = $conexionodbc.Exec(exisqueryrequest) > > While (resulobj.Available) > > If resulobj.MoveNext() Then > resulhowmany = resulhowmany + 1 > Else > Break > Endif > > Wend > > resulobj.MoveFirst ' <--- here said that its foward only, that's true if > comes from a simple select ? >
I don't understand your last question (and I have no idea about bean-like objects outside of gardening) but according to the Result.MoveNext() documentation [1]: Returns TRUE if the result is void or if there is no next record. You seem to increment your counter when the move *fails*, which will give you a wrong count. I usually do something like: ' Modifies the internal Result record pointer! Private Sub CountResult(hRes As Result) As Integer Dim iCount As Integer If hRes.MoveFirst() Then Return 0 iCount = 1 While Not hRes.MoveNext() Inc iCount Wend Return iCount End Regards, Tobi [1] http://gambaswiki.org/wiki/comp/gb.db/result/movenext -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user