I seem to be getting a null connection when using the below Code
private static string LoadConnectionString(string id = "Default")
{
return ConfigurationManager.ConnectionStrings[id].ConnectionString;
}
using (IDbConnection cnn = new SqliteConnection(LoadConnectionString()))
{
cnn.Execute("INSERT INTO Main (Member_Name, Member_ID, Member_Roles, Guilds, Points, Level, Exp) VALUES (@Member_Name, @Member_ID, @Member_Roles, @Guilds, @Points, @Level, @Exp)",
new { Member_Name = username, Member_ID = id, Member_Roles = roles, Guilds = guild_id, Points = 0, Level = 0, Exp = 0 });
}
Here is my App.config "add" field below
<add name="Default" connectionstring="Data Source=.\Database\The_G_Database.sqlite;Version=3;" providername="System.Data.SqlClient">
What I have tried:
I have tried using a direct string to my directory and different types such as referencing the connection as its own type "
SqliteConnection cnn = new SqliteConnection(LoadConnectionString())