wp8 でトラッカー アプリケーションを実行しようとしています。Sqliteを使用してデータベースに値を保存したい。すべての値が有効です (時間、距離、ペース)。停止ボタンを押した後、2番目の画面でわかるように、Sqliteを使用してテーブルビューに値を投稿したいと思います。良い提案やリンクは大歓迎です。ありがとう。
1341 次
2 に答える
1
こちらのnokia 開発者サイトをお試しください。
Windows Phone で sqlite を使用する方法についての簡単なチュートリアルを提供します。
このコードで答えが得られますか?
private void Insert_Click_1(object sender, RoutedEventArgs e)
{
// Create a new task.
Task task = new Task()
{
Title = TitleField.Text,
Text = TextField.Text,
CreationDate = DateTime.Now
};
/// Insert the new task in the Task table.
dbConn.Insert(task);
/// Retrieve the task list from the database.
List<Task> retrievedTasks = dbConn.Table<Task>().ToList<Task>();
/// Clear the list box that will show all the tasks.
TaskListBox.Items.Clear();
foreach (var t in retrievedTasks)
{
TaskListBox.Items.Add(t);
}
}
うーん、これは検索用のコードです。多分このサイトはあなたをさらに助けます.
次の例は挿入です。
public void Initialize()
{
using ( var db = new SQLite.SQLiteConnection( _dbPath ) )
{
db.CreateTable<Customer>();
//Note: This is a simplistic initialization scenario
if ( db.ExecuteScalar<int>(
"select count(1) from Customer" ) == 0 )
{
db.RunInTransaction( () =>
{
db.Insert( new Customer() {
FirstName = "Jon", LastName = "Galloway" } );
db.Insert( new Customer() {
FirstName = "Jesse", LastName = "Liberty" } );
} );
}
else
{
Load();
}
}
}
于 2013-07-01T14:15:10.530 に答える