Home News DOC Class DL Others Rice
Class  >  connection  >  AddColumn(string,string,string)
connection class : AddColumn(string,string,string) method

Description

Adds a column to the table.

Syntax

instance.AddColumn(string tablename, string columnname, string datatype)

Arguments

ClassNameDescription
stringtablenameTable name.
stringcolumnnameColumn name.
stringdatatypeData 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.

Copyright © Rice All rights reserved.