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

Nigel Gerrard linus at ...38...
Thu Sep 2 22:19:14 CEST 2004


Notorious,

Could you tell me which database driver you are using as alias support
is unfortunately different on each.

Nigel

On Thu, 2004-09-02 at 20:44, Notorious wrote:
> 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!!
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
> _______________________________________________
> 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