connection class : AddColumn(string,string,string) method
Description
Adds a column to the table.
Syntax
instance.AddColumn(string tablename, string columnname, string datatype)
Arguments
| Class | Name | Description |
| string | tablename | Table name. |
| string | columnname | Column name. |
| string | datatype | Data type. |
Return value
None.
Sample code
| 1: | connection cnn = new connection("Data Source=c:\somedirectory\somedatabase.sqlite3;Version=3;"); |
| 2: | cnn.Open(); |
| 3: | dictionary{string} ds; |
| 4: | ds.Add("ids","integer"); |
| 5: | ds.Add("textdata","text"); |
| 6: | // create table example_tbl(ids integer, textdata text); |
| 7: | cnn.CreateTable("example_tbl", ds); |
| 8: | // alter table example_tbl add column newcolumn text; |
| 9: | cnn.AddColumn("example_tbl", "newcolumn", "text"); |
| 10: | cnn.Close(); |
| 11: | cnn.Release(); |
Notes
Creates and executes an ALTER TABLE statement. In the above sample code, the following SQL statement will be created.
alter table example_tbl add column newcolumn text;
Links for reference
None.


