[Gambas-user] Add field
Benoit Minisini
benoit.minisini at ...2...
Sat Mar 4 15:10:34 CET 2006
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.
Regards,
--
Benoit Minisini
More information about the User
mailing list