accessing database in c# godot
Asked Answered
W

3

0

im using sqlite and dapper , tried entity framework but no luck there either.
i used using() as well as opening and closing the connection my self to but nothing works. im going to upload the project i would be thankful if someone could help

Whitecollar answered 14/12, 2023 at 13:19 Comment(0)
S
0

Whitecollar but nothing works

Like what doesn't work exactly, the errors produced and what have you done to verify it isn't working? If it doesn't produce any errors, are you sure Human.db doesn't exist (perhaps somewhere unexpected?). Did you try reading data from the DB?

Are you aware of the godot plugin (that uses gdscript?): https://godotengine.org/asset-library/asset/1686

Seamstress answered 14/12, 2023 at 14:52 Comment(0)
W
0

Seamstress Human.db exists and I'm verifying this with SQLite studio that no record is being added
im geting this error but its one of those that tell you nothing:
E 0:00:02:0727 void System.ArgumentNullException.Throw(string): System.ArgumentNullException: Value cannot be null. (Parameter 'path1')
<C++ Error> System.ArgumentNullException
<C++ Source> :0 @ void System.ArgumentNullException.Throw(string)
<Stack Trace> :0 @ void System.ArgumentNullException.Throw(string)
:0 @ string System.IO.Path.Combine(string, string)
:0 @ System.Data.SQLite.SQLiteConnection..ctor(string, bool)
:0 @ System.Data.SQLite.SQLiteConnection..ctor(string)
:0 @ System.Data.SQLite.SQLiteConnection..ctor()
Be.cs:17 @ void Test_app_project.Be.Save(Test_app_project.Human)
Main.cs:30 @ void Main.OnRunButtonPressed()
Main_ScriptMethods.generated.cs:49 @ bool Main.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&)
CSharpInstanceBridge.cs:24 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(nint, Godot.NativeInterop.godot_string_name, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error, Godot.NativeInterop.godot_variant*)

Whitecollar answered 14/12, 2023 at 18:4 Comment(0)
S
0

This looks like a path issue from the stack trace, I'm going to assume the connection string is incorrect; perhaps you could remove the path as I'm unsure if the path means anything when running in godot (as it has its own file system). Some examples here: https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/connection-strings#examples

I'd just try the filename for now.

Seamstress answered 15/12, 2023 at 10:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.