public void CreateDataBase(string dbPath, string pwd)
{
if (!File.Exists(dbPath))
{
SqliteConnection.CreateFile(dbPath);
if (string.IsNullOrEmpty(pwd))
{
using (SqliteConnection conn = new SqliteConnection("Data Source=" + dbPath))
{
try
{
conn.SetPassword(pwd);
}
catch
{
conn.Close();
throw;
}
finally
{
conn.Close();
}
}
}
}
else
throw new Exception("已经存在名叫:" + dbPath + "的数据库!");
}