public IList<HighScore> GetAllhs() { IList<HighScore> list = null; using (HighScoreDataContext context = new HighScoreDataContext(HighScoreDataContext.DBConnectionString)) { IQueryable<HighScore> query = from c in context.HighScores select c; list = query.ToList(); } return list; }
// Constructor public MainPage() { InitializeComponent(); BackKeyPress += MainPage_BackKeyPress; using (HighScoreDataContext context = new HighScoreDataContext(HighScoreDataContext.DBConnectionString)) { if (!context.DatabaseExists()) context.CreateDatabase(); } }
public void Addhs(string name,string score) { using (HighScoreDataContext context = new HighScoreDataContext(HighScoreDataContext.DBConnectionString)) { HighScore hs = new HighScore(); hs.NameFish = name; hs.Score = score; hs.ID = HigScoreIn.cnt++; hs.Date = DateTime.Now; context.HighScores.InsertOnSubmit(hs); context.SubmitChanges(); } }