Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If the SQLite database does not need to be populated with much data before distribution, you can just create it on runtime. If you want it to be in the same location as your executable, try this to create it (VB.Net code)</p> <pre><code> Dim SQLconnect As New SQLite.SQLiteConnection() SQLconnect.ConnectionString = "Data Source=" &amp; Application.StartupPath &amp; "\database.db;" SQLconnect.Open() SQLconnect.Close() </code></pre> <p>This will create a blank database file and if you want to create the tables and/or load some data, you could do something like this (after checking to see if the tables already exist of course):</p> <pre><code> If tblSettingsExist = False Then SQLconnect.Open() SQLcommand = SQLconnect.CreateCommand SQLcommand.CommandText = "CREATE TABLE Settings(setting TEXT PRIMARY KEY, value TEXT);" SQLcommand.ExecuteNonQuery() SQLcommand.Dispose() SQLconnect.Close() 'add records for all default settings SQLite_InsertRecord("Settings", "setting, value", "'someSetting1', '-1'") SQLite_InsertRecord("Settings", "setting, value", "'someSetting2', '0'") SQLite_InsertRecord("Settings", "setting, value", "'someSetting3', '1'") End If </code></pre> <p>Just for completeness, here is the subroutine I use to insert data:</p> <pre><code>Public Sub SQLite_InsertRecord(ByVal table As String, ByVal fields As String, ByVal values As String) Dim SQLcommand As SQLiteCommand SQLconnect.Open() SQLcommand = SQLconnect.CreateCommand SQLcommand.CommandText = "INSERT INTO " &amp; table &amp; " (" &amp; fields &amp; ") VALUES (" &amp; values &amp; ")" Try SQLcommand.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Database Insertion Error") Finally SQLcommand.Dispose() SQLconnect.Close() End Try End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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