【发布时间】:2010-02-12 08:39:02
【问题描述】:
在 C# 中如何清空现有的 SQLite 数据库?
是否可以通过连接字符串?还是由 SQLite 经理?
我不想发出 drop all tables 语句。
我有这段代码,这里的new表示如果不存在就新建一个。
try
{
connStr = @"Data Source=" + databaseFilePath + ";New=True;Version=3;";
conn = new SQLiteConnection(connStr);
cmd = new SQLiteCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.Connection.Open();
}
catch (Exception e)
{
MessageBox.Show("Caught exception: " + e.Message);
addError("Caught exception: " + e.Message,true);
return false;
}
【问题讨论】: