[Gambas-user] Problem with TableView & Mysql (strange unknown field error)

Notorious notorious at ...606...
Thu Sep 2 21:44:37 CEST 2004


Hi

Thank you for reading this :)
I'm running linux debian (2.6) & gambas 0.98a
I want to read out a query result and put in a tableview.
All goes well but when I use a more advanced query (i.e with 
from_unixtime(<column>) ) I get an "unknown field error: .<field>" error.

Example:
(from database example)

PRIVATE $hConn AS Connection
PRIVATE $rdata AS Result

public sub form_open()
<insert establish conn code here :)>
end

PRIVATE SUB ReadData()
 
  DIM htable AS Table
  DIM hfield AS ResultField
  DIM sfield AS String
  DIM iInd AS Integer

  INC Application.Busy

  $rdata = $hconn.Exec("SELECT * FROM foo")

*// With this query all works fine //*

  $rdata = $hconn.Exec("SELECT id,FROM_UNIXTIME(time) as bar FROM foo")

*// Using this one I would get the error: "Unknown field: .bar", same 
with INET_TOA //*
 
  Table1.Rows.Count = 0
 
  Table1.Columns.Count = $rdata.Fields.Count
 
  FOR EACH hfield IN $rdata.Fields
    WITH hfield

      Table1.Columns[iInd].Text = .Name
      Table1.Columns[iInd].Width = WidthFromType(table1,.Type,.Length,.Name)
     
    END WITH
  INC iInd
  NEXT
 
  Table1.Rows.Count = $rdata.Count
 
FINALLY
 
  DEC Application.Busy
 
CATCH

  Message.Error("Cannot exec request." & "\n\n" & Error.Text)
 
END

PRIVATE FUNCTION WidthFromType(hCtrl AS control, iType AS Integer, 
iLength AS Integer, sTitle AS String) AS Integer
 <insert it here :)>
END

PUBLIC SUB table1_Data(Row AS Integer,column AS Integer)
<insert it here :)>
END

Please help me, what am I doing wrong??

Thx

Notorious

PS:I like what you guys are doing with the program, keep up the good job!!




More information about the User mailing list