SQLiteException:无法打开数据库文件
我是windows mobile编程新手,我正在尝试使用sqlite创建一个windows mobile 6应用程序。Write now我已经构建了一个虚拟测试应用程序,在其中我尝试读取sqlite表的内容 问题是我一直收到SQLiteException:无法打开数据库文件 我的代码如下:SQLiteException:无法打开数据库文件,sqlite,windows-mobile,Sqlite,Windows Mobile,我是windows mobile编程新手,我正在尝试使用sqlite创建一个windows mobile 6应用程序。Write now我已经构建了一个虚拟测试应用程序,在其中我尝试读取sqlite表的内容 问题是我一直收到SQLiteException:无法打开数据库文件 我的代码如下: using (var cn = new SQLiteConnection(@"Data Source=C:myfirsttest.s3db;")) { try
using (var cn = new SQLiteConnection(@"Data Source=C:myfirsttest.s3db;"))
{
try
{
//Connect to SQLite database
cn.Open();
//Create the SQL Command
var cmd = new SQLiteCommand();
cmd.Connection = cn;
cmd.CommandText = "SELECT * FROM MyTable";
//Retrieve the records using SQLiteDataReader
var dr = cmd.ExecuteReader();
while (dr.Read())
{
//display records
var id = dr["ID"].ToString();
}
}
catch(Exception ex)
{
//display any exeptions
var except = ex.Message;
}
finally
{
cn.Close();
}
}
谁能帮我一下吗?或者推荐一个教程,在那里我可以找到如何在windows mobile 6项目中设置sqlite?windows CE(WinMo的基本操作系统)既没有驱动器,也没有工作文件夹的概念。这意味着所有路径都必须是完全限定的。您可能需要以下内容:
new SQLiteConnection(@"Data Source=\myfirsttest.s3db;")
或
感谢您的澄清-他是否需要连接字符串中的New=true?
new SQLiteConnection(@"Data Source=\[my app path]\myfirsttest.s3db;")