[Gambas-user] Add field
R. Stormo
rohnny at ...1248...
Sat Mar 4 15:52:21 CET 2006
gambas-user mailing list wrote:
>
> R. Stormo schrieb:
>
>>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 easy way is DDL (Data Definition Language)
> I don't know if mySql can do it, i know only oracle and mssql.
> The Syntax is like "Alter table 'tablename' create 'fieldname' Type not
> null... etc...."
>
> Regards, Staudi
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
Thanks for the info. That did the trick.
ALTER TABLE MyTable ADD NewField int4.
Checked with database manager and the fields was in place. ;)
--
Regards
Rohnny Stormo
-----------------------------------------
Gambas brings Basic to Linux.
My Gambas Community http://forum.stormweb.no
--
View this message in context: http://www.nabble.com/Add-field-t1224081.html#a3238875
Sent from the gambas-user forum at Nabble.com.
More information about the User
mailing list