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

Description

Creates a table.

Syntax

instance.CreateTable(string name, dictionary{string} columns)

Arguments

ClassNameDescription
stringnameTable name.
dictionary{string}columnsPairs of column name and 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:

cnn.Close();

9:

cnn.Release();

Notes

Creates and executes an CREATE TABLE statement. In the above sample code, the following SQL statement will be created.

create table example_tbl(ids integer, textdata text);

Specifies the column name and data type pair in the second argument.

The key of the dictionary becomes the column name.

The value of the dictionary is the data type of the column. Please specify with a string.

Links for reference

None.

Copyright © Rice All rights reserved.