0
我是新来的Windows移动编程,我试图创建一个使用SQLite的Windows Mobile 6应用程序。现在写入我已经构建了一个虚拟测试应用程序,我尝试读取sqlite表的内容。SQLiteException:无法打开数据库文件
问题是我一直收到SQLiteException:无法打开数据库文件。
我的代码如下:
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?
感谢澄清 - 他需要新=连接字符串中真的吗? – 2010-09-29 19:53:06