[Gambas-user] Need help with database.
Brought to you by:
gambas
From: Fabien B. <abi...@wa...> - 2004-05-23 13:16:37
|
I'm trying to use the gb method for create a new database insteed the SQL o= ne. But ... i don't understand how to add fields in a table.... =46abien This is a part of my test code DIM Fic AS File DIM stxt AS String DIM i AS Integer DIM j AS Integer =20 DIM CurTable AS Table con =3D NEW Connection con.Type =3D "mysql" con.Host =3D "localhost" Con.Login =3D "root" =20 con.open 'V=E9rifie si la base de donn=E9e Vitis existe ... sinon la cr=E9=E9 IF NOT Con.Database.Exist("vitis") THEN con.Database.Create("vitis") Con.Database.Find("vitis") IF NOT Con.Tables.Exist("parcellaire") THEN=20 CurTable =3D Con.Tables.Create("Parcellaire") =20 CurTable.Field.Create("idparc", gb.Integer,,0) CurTable.Field.Create("proprietaire", gb.String, 30," ") CurTable.Field.Create("fv", gb.String, 3," ") CurTable.Field.Create("idcommune", gb.Integer, ,0) 'CurTable.Field.Create("idcommune", gb.String, 30," ") CurTable.Field.Create("lieudit", gb.String, 30," ") CurTable.Field.Create("section", gb.String, 3," ") CurTable.Field.Create("cadastre", gb.integer,, 0 ) CurTable.Field.Create("Surface", gb.Float,, 0) CurTable.Field.Create("nom", gb.string, 30, 0) CurTable.Field.Create("idCepage", gb.Integer,, 0) CurTable.Field.Create("Couleur", gb.string, 15, 0) CurTable.Field.Create("dateplantation", gb.Date,, "1/01/2000") CurTable.Field.Create("surfaceplante", gb.Float,, 0) CurTable.Field.Create("idpg", gb.Integer,, 0) CurTable.Field.Create("entrerang", gb.float,, 0) CurTable.Field.Create("intercep", gb.float,, 0) CurTable.Field.Create("abouture", gb.string, 30, 0) =20 FOR EACH Curtable.Field PRINT Curtable.Field!name =20 NEXT =20 |