• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

SQLite "No such column" When there clearly is... [VB.net]


New Coder
I am new to SQLite and am trying to make a program that creates a database (if it doesn't already exist) then allow the user to input data. When I go to press 'input data' it gives the error "Microsoft.Data.Sqlite.SqliteException: 'SQLite Error 1: 'no such column: CustomerID'.'".
I can use DB Browser for SQLite and see that there is a CustomerID column made by the code. I just don't know why it is not recognised.

[CODE title="SQL Statement"]Dim CMD As String =
"INSERT INTO Record (CustomerID, FirstName, LastName, RoomNumber, StayLength, Phone, Postcode)
VALUES (CustomerID, FName, LName, RoomNum, StayLength, PhoneNumber, Postcode)"
Dim SQLCmd As New SqliteCommand(CMD, Connection)
MsgBox("Data Inserted")[/CODE]

[CODE title="Table creation"]If FileExists = False Then
Dim SQLCommand As String =
"CREATE TABLE Record (CustomerID TEXT,
FirstName TEXT,
LastName TEXT,
RoomNumber TEXT,
StayLength TEXT,
Phone TEXT,
Postcode TEXT)"
Dim cmd As New SqliteCommand(SQLCommand, Connection)
MsgBox("Database 'Record.db' created!")
End If[/CODE]
I've never used SQLite but this seems very similar to SQL and i have used that a lot. Just a few things to check. Make sure in your database that your table has a Capital R as some versions will automatically turn a caps into a lower case.

Check your table structure and make sure your SQL query has not added a extra space at the end.
Top Bottom