通过system.data.sqlite打开places.sqlite [英] open places.sqlite through system.data.sqlite

查看:121
本文介绍了通过system.data.sqlite打开places.sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有



i我实现了一个获取firefox浏览历史记录的窗口应用程序。

i知道任务完成后打开或访问placess .sqlite在c#.net

但是我有问题要访问或打开places.sqlite到c#我使用下面的代码:



使用system.data.sqlite;



SQLiteConnection sql_con;

SQLiteCommand sql_cmd;

SQLiteDataAdapter DB;

DataTable DT = new DataTable();



string dbpath =C:\Users\administrator\AppData\Roaming\ Mozilla \ Firefox \Profiles\2f92gtpv.default\places.sqlite



sql_con = new SQLiteConnection(Data Source =+ dbPath +

; Version = 3; New = False; Compress = True;);



//打开连接

sql_con.Open();

sql_cmd = sql_con.CreateCommand();



//选择查询

string Co mmandText =select * from+ table;





但是当打开连接时我收到错误:文件打开不是数据库文件

文件已加密或不是数据库



甚至places.sqlite数据库在sqlite manger中完全打开,我可以在那里写查询如果有人有任何解决方案,请提供完美的解决方案



thanx&问候

Sanjay

解决方案

看看你的代码:

  string  dbpath =  数据源= C:\\Users \\administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\9efj78uh.default\\places.sqlite;版本= 3;新= False; Compress = false; 

sql_con = new SQLiteConnection( Data Source = + dbPath +
; Version = 3; New = False; Compress = True;);

那么什么是打开连接的字符串的值?

Data Source =



加上dbPath的内容,加上

; Version = 3; New = False; Compress = True;

所以:

数据源=数据源= C:\\Users \\administrator \\AppData \\Roaming\\Mozilla \\ Firefox \\\ \\Profiles\\9efj78uh.default\\places.sqlite;版本= 3;新= FALSE;压缩=假;;版= 3;新= FALSE;压缩= TRUE; 

哪个不是数据库文件!您可能想要从dbPath中删除填充:

  string  dbpath =   C:\\Users \\administrator \\AppData \\Roaming\\Mozilla \\ Firefox\\Profiles\\9efj78uh.default\\places.sqlite; 


hi all

i am implementing a window application for getting firefox browsing history.
i know that task complete by open or access "placess.sqlite" in c#.net
but i have problem to access or open places.sqlite through c# i use the code below :

using system.data.sqlite;

SQLiteConnection sql_con;
SQLiteCommand sql_cmd;
SQLiteDataAdapter DB;
DataTable DT = new DataTable();

string dbpath="C:\Users\administrator\AppData\Roaming\Mozilla\Firefox\Profiles\2f92gtpv.default\places.sqlite"

sql_con = new SQLiteConnection("Data Source=" + dbPath +
";Version=3;New=False;Compress=True;");

// Open the Connection
sql_con.Open();
sql_cmd = sql_con.CreateCommand();

// Select Query
string CommandText = "select * from " + table;


but when open the connection i got error:File opened that is not a database file
file is encrypted or is not a database

even places.sqlite database is perfectly open in sqlite manger and i can write query there and its provide result in well maner

if anyone have any solution please provide perfect solution

thanx & regards
Sanjay

解决方案

Look at your code:

string dbpath="Data Source=C:\\Users\\administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\9efj78uh.default\\places.sqlite;Version=3;New=False;Compress=false;"

sql_con = new SQLiteConnection("Data Source=" + dbPath +
";Version=3;New=False;Compress=True;");

So what is the value of the string you open the connection with?

"Data Source="


plus the content of dbPath, plus

";Version=3;New=False;Compress=True;"

So:

Data Source= Data Source=C:\\Users\\administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\9efj78uh.default\\places.sqlite;Version=3;New=False;Compress=false;;Version=3;New=False;Compress=True;

Which is not a database file! You probably want to remove the "padding from dbPath:

string dbpath="C:\\Users\\administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\9efj78uh.default\\places.sqlite";


这篇关于通过system.data.sqlite打开places.sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆