[Gambas-user] create tables

PaquitoSoft cloroetilo at ...626...
Tue Jun 21 18:11:09 CEST 2005


Hi all!

I'm using Gambas 1.9.8 under Debian/GNU Linux

I want my application to create a database the first time it is run.
So I check if it already exists and I create it if not.
Until here everything is ok, but the problem arraives when i try to
create the tables for the database.
This is how I'm trying:

DIM conexion as Connection
DIM tabla as Table
DIM location as String

WITH conexion
    .Type = "sqlite"
    .Host = location
    .Open()
	
    IF .Databases.Exist("Paquito") THEN
      PRINT "Database already exists"
    ELSE
      .Databases.Add("Paquito")
      PRINT "New Database created"
    END IF

    .Close()
    .Host = location &/ "Paquito"
    .Open()

    tabla = .Tables.Add("preferencias")
    tabla.Fields.Add("idioma", GB.String, 5)
    tabla.Fields.Add("interfaz", GB.String, 5)
    tabla.Fields.Add("maxUp", GB.Integer)
    tabla.Fields.Add("maxDown", GB.Integer)
    tabla.Update()
    .Close()
END WITH

location is a String containing the directory where I will store the
database.
After I run this code I get a new Database in that folder with the name
I put and, of course, is a sqlite sigle-fil database.
The problem is that no table is created within the database, so...
What am I doing wrong??

Thank you all guys! this mailing list is great

-- 
El tiempo es un gran profesor. Desafortunadamente, mata a todos sus
alumnos.





More information about the User mailing list