Today I started working with databases. I installed SQLite and SQLite-net. I am programming a Windows 8.1 application using C #.
All I have is the following:
Model:
public class Subject
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Name { get; set; }
}
And OnLaunched-Event in App.Xaml.cs contains:
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
[...]
DBPath = Path.Combine(
Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Subjects.s3db");
using (var db = new SQLite.SQLiteConnection(DBPath))
{
db.CreateTable<Subject>();
}
[...]
}
When I run this, I get the following error after db.CreateTable (); performed:
Unable to add PRIMARY KEY column.
What's going on here? I really would appreciate your help.
Many thanks.
Cheers, FunkyPeanut
source
share