Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am using following code in window 7.
i want to get my google chrome history. i am using following code



C#
private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = "Google crome";
            string Google = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\Google\\Chrome\\User Data\\Default\\History";
            SQLiteConnection cn = new SQLiteConnection("Data Source=" + Google + ";Version=3;New=False;Compress=True;");
            cn.Open();
            SQLiteDataAdapter DA = new SQLiteDataAdapter("select url,title,visit_count,last_visit_time from urls order by last_visit_time desc",cn);
            DataSet ds = new DataSet();
            DA.Fill(ds);
            dataGridView1.DataSource = ds.Tables[0];
            cn.Close();
        }


on button but it give
C#
"The database file is locked database is locked" error..


how we can resolve it plese help me.........
Posted
Updated 12-Dec-20 5:50am
v3
Comments
[no name] 22-Apr-14 8:25am    
http://www.google.com/search?q=The+database+file+is+locked+database+is+locked
ZurdoDev 22-Apr-14 9:50am    
close Chrome.
Member 11692192 10-Jun-15 6:44am    
I have the same issue can you please elaborate

you only have folder path string Google = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\Google\\Chrome\\User Data\\Default\\History";

when you set Data Source you need to give database file path like Data Source=c:\mydb.db;

close the connection each time after you're finished with it. you can use USING blocks
e.g:
C#
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
   conn.Open();  
  // do something with your connection 
}
 
Share this answer
 
Comments
Sampath Lokuge 22-Apr-14 9:04am    
+5 :)
To solve this just copy "History" file to other, "History.1" for exemple. And open it with sqlite function.
 
Share this answer
 

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