C
C#4w ago
hutonahill

What's up with SQLite and Jetbrains Rider

I am debugging a metod and its saying a row is missing from the table. This made no since, so i wiped open SQLiteStudio and took a loo at the file. the row is there alright. So i add a breakpoint and check the connection.
private const string ServerDataConnection = "Data Source=ServerData.db;Version=3;";
using (var connection = new SQLiteConnection(ServerDataConnection)) {
private const string ServerDataConnection = "Data Source=ServerData.db;Version=3;";
using (var connection = new SQLiteConnection(ServerDataConnection)) {
The connection has a property, FileName, that i assume has the FilePath of the sqlite file. its pointing to a file in /bin/debug file, not my sqlite file. what's up with this??? why not point at the file in my primary directory?
No description
108 Replies
Jimmacle
Jimmacle4w ago
because that's not the typical working directory for C# programs the default working directory is the location of the built executable if you have data that you want copied to the output folder, you can configure that per file in the IDE by right clicking the file and going to properties or use an absolute path instead of a relative one, then it doesn't matter what the working directory is
hutonahill
hutonahill4w ago
would that be a build action?
Jimmacle
Jimmacle4w ago
no, it's the "copy to output directory" option below that
hutonahill
hutonahill4w ago
oh, i see that
Jimmacle
Jimmacle4w ago
build action should be none for regular non-code files
hutonahill
hutonahill4w ago
is there a way i can make changes come back when we are done building?
Jimmacle
Jimmacle4w ago
what do you mean if you want to work on the file your program is also working on, just put it in the bin folder and don't have anything in your source folder
hutonahill
hutonahill4w ago
so my program makes changes to this database. idealy is back here where i can look at it once the program makes changes
Jimmacle
Jimmacle4w ago
or use the absolute path option
hutonahill
hutonahill4w ago
k, i will have to put that in a config so i dont screw this up when i finish this and deploy it thx so thats what a bin folder is... amazing ive gotten this far not knowing that.
Jimmacle
Jimmacle4w ago
yeah that's where your actual program ends up
hutonahill
hutonahill4w ago
very very good to know
Jimmacle
Jimmacle4w ago
if you wanted, you could copy those files to some other place/computer and run the exe and it would run (assuming the .NET runtime is installed)
hutonahill
hutonahill4w ago
no clue! my c# class didnt do much more than mention .NET existed. frankly not sure what the diferance is between c# and .NET
Jimmacle
Jimmacle4w ago
it's basically all the libraries and other guts that make your C# program actually run
Want results from more Discord servers?
Add your server