[Gambas-user] displaying mysql query result into gridview

Nugroho Al Gopar nugroho.redbuff at ...626...
Sat Mar 12 03:35:15 CET 2011


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.





More information about the User mailing list