[Gambas-user] MySQL and general data issues

Charlie Reinl Karl.Reinl at ...2345...
Mon Mar 1 23:36:51 CET 2010


Am Montag, den 01.03.2010, 16:22 -0500 schrieb Keith Clark:
> I am trying to access some data using the documentation "A Beginner's
> Guide to Gambas" and I've gotten this far:
> 
> PUBLIC SUB SearchButton_Click()
> 
>   DIM $Query AS String
>   DIM $Result AS Result
>   DIM iIndex AS Integer
>   DIM hField AS ResultField
>   
>   DatabaseConnection.Connect()
>   
>   $Query = "select products.products_model as ISBN,
> products_description.products_name AS Title,
> manufacturers.manufacturers_name AS Author,
> categories_description.categories_name AS Genre,
> products.products_quantity AS Quantity FROM products Left join
> products_description on products.products_id =
> products_description.products_id Left join manufacturers on
> products.manufacturers_id = manufacturers.manufacturers_id Left join
> products_to_categories on products.products_id =
> products_to_categories.products_id Left join categories_description on
> products_to_categories.categories_id =
> categories_description.categories_id where
> products_description.products_name LIKE '%blue%'"
>   $Result = DatabaseConnection.$Con.Exec($Query)
>   TitleSearchTableView.Rows.count = 0
>   TitleSearchTableView.Columns.Count = $Result.Fields.Count
>   FOR EACH hField IN $Result.Fields
>     WITH hField
>       TitleSearchTableView.Columns[iIndex].Text = .Name
>       TitleSearchTableView.Columns[iIndex].Width =
> WidthFromType(TitleSearchTableView, .Type, .Length, .Name)
>     END WITH
>     INC iIndex
>   NEXT 
> 
> But I get an error:
> 
> Unknown identifier:  WidthFromType
> 
> Not sure what I'm doing wrong here.  Maybe just not understanding it
> well enough yet.
> 
> Keith

Salut Keith,

you have to look for the function "WidthFromType" which returns  the
width for the field. Should be in the example.
If you can't find it, a workaround could be this:
replace : TitleSearchTableView.Columns[iIndex].Width =
WidthFromType(TitleSearchTableView, .Type, .Length, .Name)
by 
TitleSearchTableView.Columns[iIndex].Width = 50

Or/and look if you don't have a typo !?

-- 
Amicalement
Charlie





More information about the User mailing list