Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Create SQLite Db and table using C#

/// 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();
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Create #SQLite #Db #table
ADD COMMENT
Topic
Name
2+9 =