如何从SQlite数据库中清除浏览器历史记录 [英] how to clear browser history from SQlite database
本文介绍了如何从SQlite数据库中清除浏览器历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是在datagridview中获取浏览器文件的代码,但是我无法从数据库中删除浏览器历史记录。
this is the code to get the browser files in the datagridview but i can't delete the browser history fro m database.
string opera = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Opera Software\opera stable\History";
SQLiteConnection con = new SQLiteConnection("DataSource=" + opera + "; version=3; new =false;compress=true;"
SQLiteDataAdapter sd = new SQLiteDataAdapter("select * from URLS", con);
DataSet ds = new DataSet();
sd.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
con.Close();
推荐答案
使用上面的DELETE命令,或者假设您在sd.Fill(ds)调用期间获取历史记录,请删除包含数据集表中的历史记录。
Use the above DELETE command or, assuming you are getting the history during the sd.Fill(ds) call, remove the column containing the history from the data sets table.
// Get the table
DataTable table = ds.Tables[0];
// Remove the column by name (if you know it)
table.Columns.Remove("History");
dataGridView1.DataSource = table;
或者,
Alternatively,
dataGridView1.DataSource = ds.Tables[0].Columns.Remove("History");
就SqLite而言,你不能只删除一列,你需要创建一个新表,删除列,然后将新表复制到另一个表中。
完成此操作的步骤已在此处得到解答。您会注意到他们也会解释并提供有关SqLite限制的链接。
从SQL表中删除列 [ ^ ]
创建SqliteCommand [ ^ ]并执行删除声明 [ ^ ]
Create SqliteCommand[^] and execute delete statement[^]
>
这篇关于如何从SQlite数据库中清除浏览器历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文