Hello
I'm creating simple Windows Phone 7.1 SDK application
I need to create small database. To do so, I've installed SQL Server Compact Toolbox. I've created table named TrainingData, which contains 3 columns: ID(PK, int, not null) identity (autoincrements), Data (datetime, null), Time(nchar(15),null). After creating table I've used option Add Windows Phone Data Context to current project, which automatically created TrainingDBContext.
Now, in one page I want to save data to database on click:
private void btnSaveActivity_Click(object sender, RoutedEventArgs e)
{
using (TrainingDBContext context = new TrainingDBContext(TrainingDBContext.ConnectionString))
{
DateTime date = DateTime.Now;
context.TrainingData.InsertOnSubmit();
}
}
The problem is, context sees ontly TrainingData. I can't access to data column this way: context.data.InsertOnSubmit(date) which throws this error:
Error 1 'PhoneApp1.TrainingDBContext' does not contain a definition for 'data' and no extension method 'data' accepting a first argument of type 'PhoneApp1.TrainingDBContext' could be found (are you missing a using directive or an assembly reference?)
Anyone knows solution to this problem?
Best regards
Raston