-
Book Overview & Buying
-
Table Of Contents
Windows Application Development Cookbook
By :
It is quite difficult to imagine an application that uses a database but does not insert anything into it. Thus, it is crucial that you know how to store data in tables in the database. In this recipe, you will learn how to do it.
As an example, you will slightly modify the project from the previous recipe by adding the data of three categories while initializing the database.
To step through this recipe, you need the project from the previous recipe.
To modify the preceding example to add the data of three categories while initializing the database, modify the InitializeDatabase method in the MainViewModel class in the MainViewModel.cs file, as shown in the following code snippet:
public void InitializeDatabase()
{
using (SQLiteConnection connection = GetConnection())
{
if (connection.GetTableInfo("categories").Count == 0)
{
connection...