使用.sqlite3文件在Windows Phone 8上创建数据库 [英] Using .sqlite3 file to create a database on Windows Phone 8
本文介绍了使用.sqlite3文件在Windows Phone 8上创建数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在Windows手机上试用SQLite作为基础 http://code.msdn.microsoft.com/wpapps/Using-Sqlite-with-WP8-52c3c671 和
,数据库是在App.xaml中用这个创建的
字符串 dbPath = 路径 。 组合 (
Windows < span class ="pun"style ="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000">。 Storage 。 ApplicationData 。 当前 。 LocalFolder 。 路径 ,
" db.sqlite" );
如果 (! FileExists ( " db.sqlite" )。 Result )
{
使用 ( var db = new SQLiteConnection ( dbPath ))
{
db 。 CreateTable < 人 >();
}
}
私人 async 任务 < bool> FileExists ( string fileName )
{
var result = false ;
尝试
{
var store = await Windows
。 存储 。 ApplicationData 。 当前 。 LocalFolder
。 GetFileAsync ( fileName );
result = true ;
}
catch { }
返回 result ;
}
我有一个带有我创建的数据库的database.sqlite3文件,如何使用该文件在我的Windows手机应用程序上创建数据库?
解决方案
我不明白这个问题。本教程向您展示如何使用该文件以及如何使用,创建记录等等.... 你能不能更多具体
I've been trying out SQLite on windows phone using this tutorial as basehttp://code.msdn.microsoft.com/wpapps/Using-Sqlite-with-WP8-52c3c671 and in it, the Database is created in the App.xaml with this
string dbPath = Path.Combine(
Windows.Storage.ApplicationData.Current.LocalFolder.Path,
"db.sqlite");
if (!FileExists("db.sqlite").Result)
{
using (var db = new SQLiteConnection(dbPath))
{
db.CreateTable<Person>();
}
}
private async Task<bool> FileExists(string fileName)
{
var result = false;
try
{
var store = await Windows
.Storage.ApplicationData.Current.LocalFolder
.GetFileAsync(fileName);
result =true;
}
catch { }
return result;
}
I have a database.sqlite3 file with a database I created, how i can use that file to create the database on my windows phone app ?
解决方案
I don't understand the question. The tutorial shows you how to use the file and how records can be used, created etc.... Can you be more specific?
这篇关于使用.sqlite3文件在Windows Phone 8上创建数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文