[Gambas-user] MySQL and general data issues

Keith Clark keithclark at ...2185...
Mon Mar 1 23:55:23 CET 2010


On Mon, 2010-03-01 at 23:36 +0100, Charlie Reinl wrote:
> 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 !?
> 
Charlie,

Thanks!  Got it.  Still other issues with it but I'm afraid I'm burned
out with learning for today!

Keith






More information about the User mailing list