■ SqliteCommand 클래스의 ExecuteNonQuery 메소드를 사용해 테이블을 생성하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
using System; using System.Data.SQLite; string connectionString = "URI=file:c:\\test.db"; using(SQLiteConnection sqliteConnection = new SQLiteConnection(connectionString)) { sqliteConnection.Open(); using(SQLiteCommand sqliteCommand = new SQLiteCommand(sqliteConnection)) { sqliteCommand.CommandText = @"CREATE TABLE Cars(Id INTEGER PRIMARY KEY, Name TEXT, Price INT)"; sqliteCommand.ExecuteNonQuery(); } sqliteConnection.Close(); } |