Reputation: 651
I have to create a local database for my application. Can someone help me? I want write it in sql with a query like "create table ..." not with sqlite-net.
Upvotes: 0
Views: 121
Reputation: 3568
You can still use SQLite without SQLite-net.
Just get it from the Gallery and do stuff like:
SQLiteCommand command = new SQLiteCommand(connection);
command.CommandText = "CREATE TABLE IF NOT EXISTS beispiel ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(100) NOT NULL);";
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO beispiel (id, name) VALUES(NULL, 'Test-Datensatz!')";
command.ExecuteNonQuery();
command.CommandText = "SELECT name FROM beispiel ORDER BY id DESC LIMIT 0, 1";
SQLiteDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine("Name: \"{p}\"", reader[0].ToString());
}
reader.Close();
reader.Dispose();
command.Dispose();
Upvotes: 1