大家好,我一直在努力在我的C#2.0应用程序中使用sqlite,我终于决定摆脱假设并提出真正基本的问题.
当我创建一个数据库说iagency与表用户,从外部工具,如firefox插件和另一个sqladmin工具,我无法从它显示的vs2005里面的sqlicommand查询它System.Data.SQLite.SQLiteException:Sqlite Error no such table users,请放心,我已经参考了system.data.sqlite使用SQLite-1.0安装. 61.0 -设置
当我做相反的事情就像从VS服务器资源管理器和VS数据库gui工具创建一个数据库和一个表时,它既不能被查询,也不能被其他工具查看,但是通过查询从VS使用stringbuilder创建表格,例如create table bla bla .它可以显示在数据网格中,但没有一个工具可以查看和显示该表.
在我的应用程序中,我需要做什么才能使SQLITE工作?
我试图添加sqlite3.dll从sqlite站点下载的sqlitedll-3_6_14.zip作为我的应用程序的参考预编译二进制文件,但它失败了make sure it's accessible an it's a valid assembly or com component.
Nif*_*fle 11
我下载了这个SQLite-1.0.61.0-setup.exe然后我写了这个来访问firefox收藏的sqlite db.
using System.Data.SQLite; // Dont forget to add this to your project references
// If the installation worked you should find it under
// the .Net tab of the "Add Reference"-dialog
namespace sqlite_test
{
class Program
{
static void Main(string[] args)
{
var path_to_db = @"C:\places.sqlite"; // copied here to avoid long path
SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + path_to_db + ";Version=3;New=True;Compress=True;");
SQLiteCommand sqlite_command = sqlite_connection.CreateCommand();
sqlite_connection.Open();
sqlite_command.CommandText = "select * from moz_places";
SQLiteDataReader sqlite_datareader = sqlite_command.ExecuteReader();
while (sqlite_datareader.Read())
{
// Prints out the url field from the table:
System.Console.WriteLine(sqlite_datareader["url"]);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23525 次 |
| 最近记录: |