[Gambas-user] Show records on a WebTable

Tobias Boege taboege at ...626...
Tue Mar 21 19:14:56 CET 2017


On Tue, 21 Mar 2017, herberth guzman wrote:
> >Le 17/03/2017 à 20:18, Tobias Boege a écrit :
> > I didn't test it, but the following is approximately how it goes:
> >
> >   Public Sub WebTable1_Data(Row As Integer, Column As Integer, Data As WebTableData)
> >     Dim i As Integer
> >     Dim f As ResultField
> >
> >     cx = M_DB.Connect()
> >     rs = cx.Exec("SELECT * FROM tbcategory")
> >
> >     ' Go to the Row-th record in your result
> >     For i = 0 To Row - 1
> >       rs.MoveNext
> >     Next
> 
> >--> Please use rs.MoveTo(I) instead. :-)
> 
> >--
> >Benoît Minisini
> 
> 
> Tobias - Benoit thanks for your help, it has been useful.
> My webtable works fine.
> 
> 
> Public Sub WebTable1_Data(Row As Integer, Column As Integer, Data As
> WebTableData)
> 
>   Dim i As Integer
>   Dim f As Resultfield
> 
>   cx = M_DB.Connect()
>   rs = cx.Exec("SELECT Title FROM tbapps where tbapps.Title like  '%'")
> 
>   For i = 0 To Row - 1
>     rs.MoveTo(i)
>   Next
> 

What Benoit meant was to replace the whole loop above by a single call to

  rs.MoveTo(Row)

>   If rs.Available Then
>     i = rs.Fields.Count
>     For Each f In rs.Fields
>       If i = Column Then Break
>       Inc i
>     Next
>     Data.Text = rs[f.Name]
>   Endif
> 
> End
> 

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list