[Gambas-user] displaying mysql query result into gridview
Michael
mdavies5 at ...169...
Sat Mar 12 04:44:35 CET 2011
Nugroho,
Sorry, I just cut and pasted some existing code. You can delete the
reference to
LoadChargeCombos. This is a local routine to populate some combo boxes.
The rest of your code should work fine.
Best Wishes
Michael
On 12/03/11 13:35, Nugroho Al Gopar wrote:
> Hi Michael
>
> I've try to use your script replied to me in my program. But I need few
> explanations.
> 1. Where should I put the code? It is something like bellow?
> ------------------------
> ' Gambas class file
>
> PRIVATE SUB PopulateCharges()
> DIM rsCharges AS Result
> DIM intRow AS Integer = 0
> DIM strType AS String = ""
>
> sql.getSQL 'for connect to database
> rsCharges = sql.$hConn.Exec("SELECT * FROM makul") 'executing query
> IF rsCharges.Available THEN
> rsCharges.MoveFirst
> GridView1.Rows.Count = rsCharges.Count
> FOR EACH rsCharges
> GridView1[intRow, 0].Text = rsCharges!unique_id
> GridView1[intRow, 1].Text = rsCharges!charge_source
> GridView1[intRow, 2].Text = rsCharges!charge_type
> 'rsCharges!charge_display
> INC intRow
> NEXT
> sql.UpdateStatus(rsCharges.Count& " Charge records returned
> ")
> LoadChargeCombos(rsCharges)
> GridView1.Row = intRow - 1
> ENDIF
> CATCH
> Message.Error(Error.Class.Name& ": "& Error.Where& ": "
> & Error.Text)
> END
>
> PUBLIC SUB Form_Open()
>
> PopulateCharges()
>
> END
>
> ------------------------
> 2. LoadChargeCombos is detected as unknown identifier in my program. Is
> it a procedure you have. If it is, please let me know the script.
>
> Thanks.
>
>
> ------------------------------------------------------------------------------
> 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