■ 레코드 추가하기

----------------------------------------------------------------------------------------------------

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 = "INSERT INTO Cars VALUES(1,'Audi',52642)";

 

        sqliteCommand.ExecuteNonQuery();

 

        sqliteCommand.CommandText = "INSERT INTO Cars VALUES(2,'Mercedes',57127)";

 

        sqliteCommand.ExecuteNonQuery();

 

        sqliteCommand.CommandText = "INSERT INTO Cars VALUES(3,'Skoda',9000)";

 

        sqliteCommand.ExecuteNonQuery();

 

        sqliteCommand.CommandText = "INSERT INTO Cars VALUES(4,'Volvo',29000)";

 

        sqliteCommand.ExecuteNonQuery();

 

        sqliteCommand.CommandText = "INSERT INTO Cars VALUES(5,'Bentley',350000)";

 

        sqliteCommand.ExecuteNonQuery();

 

        sqliteCommand.CommandText = "INSERT INTO Cars VALUES(6,'Citroen',21000)";

 

        sqliteCommand.ExecuteNonQuery();

 

        sqliteCommand.CommandText = "INSERT INTO Cars VALUES(7,'Hummer',41400)";

 

        sqliteCommand.ExecuteNonQuery();

 

        sqliteCommand.CommandText = "INSERT INTO Cars VALUES(8,'Volkswagen',21600)";

 

        sqliteCommand.ExecuteNonQuery();

    }

 

    sqliteConnection.Close();

}

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요