コード例 #1
0
 static void Main(string[] args)
 {
     ListBooks();
     FindBookByName("Pod Igoto");
     Book book = new Book("Added book", "Minka Svircholini", "8411929473", new DateTime(2013, 01, 12));
     AddBook(book);
 }
コード例 #2
0
 static void AddBook(Book book)
 {
     SQLiteConnection connection = new SQLiteConnection();
     connection.Open();
     using (connection)
     {
         SQLiteCommand command = new SQLiteCommand(
             "INSERT INTO Books (Title, Author, PublishDate, ISBN) " +
             "VALUES (@title, @author, @publishDate, @isbn)", connection);
         SQLiteParameter titleParam = new SQLiteParameter("@title", book.Title);
         SQLiteParameter authorParam = new SQLiteParameter("@author", book.Author);
         SQLiteParameter publishDateParam = new SQLiteParameter("@publishDate", book.PublishDate);
         SQLiteParameter isbnParam = new SQLiteParameter("@isbn", book.Isbn);
         command.Parameters.AddRange(new SQLiteParameter[] { titleParam, authorParam, publishDateParam, isbnParam });
         command.ExecuteScalar();
     }
 }