[Gambas-user] sqlite gambas table info?

PICCORO McKAY Lenz mckaygerhard at ...626...
Fri Jun 16 22:33:15 CEST 2017


umm interesting, great tobias, thanks...

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-06-16 16:17 GMT-04:00 Tobias Boege <taboege at ...626...>:

> On Fri, 16 Jun 2017, PICCORO McKAY Lenz wrote:
> > its there some code to get BEFORE send the query the fields of the table?
> >
> > i mean, in the following code example i already know the column name,
> but i
> > need firts detect column name to send amount of filters
> >
> > sCriteria *=* "id = &1"iParameter *=* *1012*$hConn*.*Begin' Same as
> > "SELECT * FROM tblDEFAULT WHERE id = 1012"hResult *=*
> > $hConn*.*Edit*(*"tblDEFAULT"*,* sCriteria*,* iParameter*)*
> >
> >
> > in this case, the column "id" was previously knowed! but in my case i
> need
> > to detect all the column names firts before send the filters/parameters
> > criteria
> >
> > please any help?
> >
>
> Look again at the properties of the Connection object. To get information
> about a table, the "Tables" property is a good start. If your Connection
> is called h you can list all tables, their fields and datatypes like this:
>
>   ' h is an open connection to a database
>   Dim t As Table, f As Field
>
>   For Each t In h.Tables
>     Print t.Name
>     For Each f In t.Fields
>       Print "  "; f.Name;; f.Type
>     Next
>   Next
>
> Use
>
>   t = h.Tables["<your_tablename>"]
>
> in place of the outer loop if you only care about a specific table.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> 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