[Gambas-user] MySQL and general data issues

Keith Clark keithclark at ...2185...
Mon Mar 1 22:22:58 CET 2010


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







More information about the User mailing list