connection クラス : CreateTable(string,dictionary{string})メソッド
説明
テーブルを作成します。
構文
instance.CreateTable(string name, dictionary{string} columns)
引数
| クラス | 名前 | 説明 |
| string | name | テーブル名 |
| dictionary{string} | columns | カラム名とデータ型の組。 |
返り値
無し。
サンプルコード
| 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(); |
注意
CREATE TABLE文を作成して実行します。上記のサンプルコードならば以下のSQL文が作成されます。
create table example_tbl(ids integer, textdata text);
第二引数でカラム名とデータ型の組を指定します。
dictionary の key がカラム名になります。
dictionary の value がカラムのデータ型になります。文字列で指定してください。
参照リンク
無し。


