[Gambas-user] Add field

Charlie Reinl na2492 at ...9...
Sat Mar 4 22:56:50 CET 2006


Am Samstag, den 04.03.2006, 15:10 +0100 schrieb Benoit Minisini:
> On Saturday 04 March 2006 13:50, R. Stormo wrote:
> > I want to add one more field to a table , on the fly, without using
> > database manager. How is this done?
> > My thinking was.
> > dim r as result
> > dim htable as table
> >
> > try r = $conn.exec("select checkfield from mytable")
> > if error.code <>0 then
> >     htable= $conn.tables["mytable"]
> >     htable.fields.add("checkfield",gb.integer)
> >     htable.update()
> > end if
> >
> > This is not working as it should , I get error "Table already exist"
> 
> The gambas database component does not know how to add a field to an already 
> existing table.
> 
> You must do the same work as the database manager do: create a table with the 
> new field added, copy the data from the old table to the new one, destroy the 
> old table, and rename the new one.

Do others, do it in a different way ? 

Oh, yes if I remember well DBase could it, but not shure.

Charlie
> 
> Regards,
> 





More information about the User mailing list