SQLiteConnection.CreateFile("MyDatabase.sqlite");
SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;");
m_dbConnection.Open();
string sql = "create table highscores (name varchar(20), score int)";
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
sql = "insert into highscores (name, score) values ('Me', 9001)";
command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
m_dbConnection.Close();
/// 09/09/2022 Mahesh Kumar Yadav. <br/>
/// <summary>
/// Create Db and Table
/// </summary>
/// <param name="path"></param>
private void CreateSqLiteDb(string path)
{
SQLiteConnection.CreateFile(path);
_connectionString = "Data Source=" + path;
var mDbConnection = new SQLiteConnection(_connectionString);
using (mDbConnection)
{
mDbConnection.Open();
const string createTableStatement =
"CREATE TABLE `Entities` ( `SN` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `ID` TEXT NOT NULL, `Name` TEXT NOT NULL, `OwnerID` TEXT, `IsGroup` INTEGER, `Status` TEXT, `Properties` TEXT, `Email` TEXT, `FirstName` TEXT, `LastName` TEXT, `AssociatedUsersOrGroups` TEXT, `GroupID` TEXT);";
var command = new SQLiteCommand(createTableStatement, mDbConnection);
command.ExecuteNonQuery();
mDbConnection.Close();
}
}