Click here to Skip to main content
15,790,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 26-Dec-13 2:02am
v3

1 solution

Look at your code:
C#
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:
C#
string dbpath="C:\\Users\\administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\9efj78uh.default\\places.sqlite";
 
Share this answer
 
Comments
sanjaysolanki 26-Dec-13 7:08am    
dear OriginalGriff
i write "C:\\Users\\administrator\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\9efj78uh.default\\places.sqlite" by mistake

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


but still i got problam
thanx & regards
krishnareddy1234 4-May-15 2:10am    
I got your problem ur db connection is OK. First of all you are using which version of dotnetFramework accordingly you can download and use System.Data.SQLite.dll file to your references then ur problem may be solved. I think you are using System.Data.SQLite.dll file that is older one

K Rama Krishna Reddy, e-mail krishnareddy1976@gmail.com
Member 11460356 19-Aug-15 8:27am    
what exactly you want to say about this code because I am also using same code and facing same problem !!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900