I use SQLite from windows app and now I am developing in Xamarin a portable app so I am using the plugin sqlite net pcl and I am having great trouble to understand how it works.
I have a table that is created by te following:
public class Config
{
public string IP { get; set; }
[SQLite.Net.Attributes.Default(true, "Client 2")]
public string ID { get; set; }
}
and to create the table:
db.CreateTable<Model.Config>();
Problem: Now I want to select the value in ID column and I do the following:
List<string> hhid = db.Query<string>("select ID from Config",null);
I get this exception: "Object reference not set to an instance of an object"
How can I make a simple select to find this field?
Thanks for any tip
List<string> hhid = db.Query<string>("select id from Config",null);
the field name isID
notid
change the Select to match the field name – Amaleedb
properly initialized? – Fereconn.Table<Config>();
– Fere