Im trying to insert data into my sqlite database which I have previously created, in vb.net:
Using objConn As New SQLiteConnection(/my path to file is here/)
Using objCommand As SQLiteCommand = objConn.CreateCommand()
objConn.Open()
objCommand.CommandText = "INSERT INTO users (username , password ) VALUES ( " + usernamevar + ", " + passwordvar + " )"
objCommand.ExecuteNonQuery()
MessageBox.Show("User created successfully")
End Using
End Using
Usernamevar and passwordvar are values which I pass into the sub above.
However, I'm receiving an error message:
System.Data.SQLite.SQLiteException: 'SQLite error no such column: aa'
With "aa" being string passed under variable Usernamevar.
I realise I must have a syntax error somewhere in the insert phrase because I can successfully insert strings or numbers into the database, however I want to insert variables. Does anyone know how to fix it? Thanks.