In my windows phone 7 app i have database-class generated by sqlmetal. in addition, i have class that helps to work with this database.
public static IList<Task> GetTasks()
{
IList<Task> tasks = new List<Task>();
using (var context = new MyDBContext(ConnectionString))
{
tasks = (from emp in context.Tasks select emp).ToList();
}
return tasks;
}
this code return all posts from the database.
My questions:
Try this:
tasks = from emp in context.Tasks
where emp.ID == yourId
select emp;
To delete posts from te databse use DeleteOnSubmit(entity)
method like:
context.Tasks.Attach(entityToDelete);
context.Tasks.DeleteOnSubmit(entityToDelete);
context.SubmitChanges();