require download System.Data.SQLite 及設定, 可見 C sharp or .Net 使用sqlite 設定
SQLiteConnection的變數定義可參考
簡單的function 如下
public void CreatSqliteDatabase()
{
/// Set Database Root
string DatabaseRoot = "c:\\test.db";
/// Set Database Password
string DB_Password = "password";
/// Check file is exits
/// File.Exists() -> using System.IO;
if (File.Exists(DatabaseRoot))
{
MessageBox.Show("Already exists.");
}
else
{
/// Creat table
SQLiteConnection.CreateFile(DatabaseRoot);
/// Open Database
SQLiteConnection cnn = new SQLiteConnection("Data Source="+DatabaseRoot);
/// Open connect
cnn.Open();
/// Set default Password
cnn.ChangePassword(DB_Password);
}
}
沒有留言:
張貼留言