[Gambas-user] displaying mysql query result into gridview
Michael
mdavies5 at ...169...
Thu Mar 10 06:58:37 CET 2011
NUgroho,
Here is code from one of my projects:
Private Sub PopulateCharges()
Dim intRow As Integer = 0
Dim strType As String = ""
If rsCharges.Available Then
rsCharges.MoveFirst
grdCharge.Rows.Count = rsCharges.Count
For Each rsCharges
grdCharge[intRow, 0].Text = rsCharges!unique_id
grdCharge[intRow, 1].Text = rsCharges!charge_source
grdCharge[intRow, 2].Text = rsCharges!charge_type
grdCharge[intRow, 3].Text = rsCharges!charge_start
grdCharge[intRow, 4].Text = rsCharges!charge_end
grdCharge[intRow, 5].Text =
rsCharges!charge_display
Inc intRow
Next
modMain.UpdateStatus(rsCharges.Count & " Charge records
returned")
LoadChargeCombos(rsCharges)
grdCharge.Row = intRow - 1
Endif
Catch
Message.Error(Error.Class.Name & ": " & Error.Where & ": "
& Error.Text)
End
I assume you have got your recordset (rsCharges) from the Db. You ned to
check how many rows are need in the grid and set this. Then populate
each row and column as above.
Regrads
Michael Davies
On 10/03/11 15:36, Nugroho Al Gopar wrote:
> I have learn how to connect mysql through gambas and make simple query
> like select * from table.
>
> My problem is, i can not display the results inti gridview or table
> view. I've try many codes style, include the code written in ebook
> titled "gambas-beginner-guide", but none is works. I put the code in my
> attachment. they are two different projects.
>
> I would like to display data from mysql table named makul. Here is the
> structure:
> kode int(2) auto_increment not null primary key,
> nama varhcar(50),
> sks int(2)
>
> the table has 5 records.
>
> Please help me solve the problem. I use this for my graduation.
>
> regard,
>
> Nugroho
>
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
>
>
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list