❔ Method WriteToTable(); isn't doing anything to the database file
My code:
In my database file, I have one table called Students and 3 columns called name, grade and phone number. I'm trying to ensure I correctly connected to the database so I decided I should try adding text under the Name column before I add anymore code.
I expected this code to output "Text" under the "Name" column to my database file, however after I press button1 nothing happens. No errors show up and no crashes occur.
I have tried debugging the code and searching online for common mistakes but sadly it did not help
5 Replies
I'm not massively experienced with SQLite, but I'm not entirely sure passing DBpath into the SQLiteCommand constructor is right.
The first string parameter is the commandText:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.data.sqlite.sqlitecommand.-ctor?view=msdata-sqlite-7.0.0#microsoft-data-sqlite-sqlitecommand-ctor(system-string-microsoft-data-sqlite-sqliteconnection)
SqliteCommand Constructor (Microsoft.Data.Sqlite)
Initializes a new instance of the SqliteCommand class.
Mmh, well I guess you are setting it afterwards.
I'm not sure that won't mess it up though.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.