Connection Error SQLite and C#
Hi ! I'm trying to make a URL shortener in C# (whoa super original) anyways, I wanna store all of that in my little SQLite db but I stumble across an issue when I am connecting / closing, it seems that multiple connections at the same time and I cannot for the life of me find how to properly away, my bad code below.
15 Replies
$nodetail
it's coming it's coming
so basically, as I understand the error given which is !
I do open / close too fast, though, I tried awaiting it all before each "call" but it still doesn't "await"
Are you running your IDE in admin mode? Are you sure you have access to the file?
I am not running ide in Admin mode no
But a quick googling just indicates it's what happens if you have a connection left open.
yes, that's what I am asking
You should be using
using
when creating IDisposable
objects.I know I am opening / closing the db but it doesn't await between each call if that makes any sense
Are you reading what I write?
I am, but I don't get it
$sqlinjection
Always parametrize queries!⠀
Do not concatenate the query, like in this example:
Instead, always parameterize your queries. Look up the documentation for your database library. If you are using
System.Data.SqlClient
, refer to this example.Please remember this
yup seen that, tbh, I'm busy trying to make the program even work before it being secure and it's only for my usage so
(I know it is good practice though)