Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use(create db, create table, query, etc) praeclarum sqlite-net?
    primarykey
    data
    text
    <p>I want to use sqlite-net available from this link <a href="https://github.com/praeclarum/sqlite-net" rel="nofollow">https://github.com/praeclarum/sqlite-net</a>.</p> <p>Unfortunately, the getting started documentation are not enough. It doesnt even mention how to create a database. I tried looking at the examples, unfortunately, the examples are broken(unable to compile, run time error etc). </p> <p>The most practical tutorial i can find on the net is <a href="http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/" rel="nofollow">http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/</a></p> <p>Unfortunately, sqlite-net doesnt fully support sqlite.org sqlite implementation, thus making the tutorial useless for praeclarum sqlite-net.</p> <p>What is the equivalent method to do the same thing from the tutorial but in praeclarum sqlite-net?</p> <p>From the tutorial</p> <p>Create database(Here is where i stuck)</p> <pre><code>SQLiteConnection.CreateFile("MyDatabase.sqlite"); </code></pre> <p>Connect to database</p> <pre><code>SQLiteConnection m_dbConnection; m_dbConnection = new SQLiteConnection("Data Source=MyDatabase.sqlite;Version=3;"); m_dbConnection.Open(); </code></pre> <p>Create table</p> <pre><code>string sql = "create table highscores (name varchar(20), score int)"; SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); </code></pre> <p>Fill table</p> <pre><code>string sql = "insert into highscores (name, score) values ('Me', 3000)"; SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); sql = "insert into highscores (name, score) values ('Myself', 6000)"; command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); sql = "insert into highscores (name, score) values ('And I', 9001)"; command = new SQLiteCommand(sql, m_dbConnection); command.ExecuteNonQuery(); </code></pre> <p>Query database</p> <pre><code>string sql = "select * from highscores order by score desc"; SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection); SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) Console.WriteLine("Name: " + reader["name"] + "\tScore: " + reader["score"]); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload