[Gambas-user] create tables
PaquitoSoft
cloroetilo at ...626...
Tue Jun 21 23:40:39 CEST 2005
I had done so. I forgot to paste that line.
I actually create an instance of Connection. In fact, it woludn't be
possible to create the database without it.
El mié, 22-06-2005 a las 01:23 +0800, Werner escribió:
> PaquitoSoft wrote:
>
> >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
> >
> >
> >
> You migth want to try
>
> DIM conexion as NEW Connection 'to create an instance
>
> Werner
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
--
El tiempo es un gran profesor. Desafortunadamente, mata a todos sus
alumnos.
More information about the User
mailing list