概要
cscの作法、調べてみた。
練習問題、やってみた。
練習問題
sqliteで、insert intoを発行せよ。
サンプルコード
using System;
using System.Text;
using System.IO;
using System.Data.SQLite;
namespace App
{
public class Program {
public static void Main(string[] args) {
SQLiteConnectionStringBuilder ConnectionStr = new SQLiteConnectionStringBuilder();
ConnectionStr.DataSource = "db0.sqlite";
using (SQLiteConnection Connection = new SQLiteConnection(ConnectionStr.ToString()))
{
Connection.Open();
using(SQLiteCommand Command = new SQLiteCommand(Connection))
{
Command.CommandText = "INSERT INTO fruit(id, name, number, price) VALUES (:id, :name, :number, :price)";
Command.Parameters.Add(new SQLiteParameter("id", 1));
Command.Parameters.Add(new SQLiteParameter("name", "mango"));
Command.Parameters.Add(new SQLiteParameter("number", 2));
Command.Parameters.Add(new SQLiteParameter("price", 500));
Command.ExecuteNonQuery();
}
}
Console.WriteLine("ok0");
}
}
}
以上。