Cannot Find SQLite Database in exe file

When I build play the game in The editor and build the game through Unity it works fine. When I run the .exe file, the game’s sqlite code does will not work.

using UnityEngine;
using System.Data;
using Mono.Data.Sqlite;
using System.Collections;
using System.Diagnostics;
using UnityEngine.UI;
using System.IO;
public class scoreLoader : MonoBehaviour
{
   
    private string dbName = "game_database";
    IDbConnection connection;

    public Text scores;
    
    private string current = "";



    // Start is called before the first frame update
    void Start()
    {


        //Opens sqlite connectiosn, reads run and time, puts them into scores
        connection = new SqliteConnection(string.Format("URI=file:Assets/Streaming Assets/{0}.db", dbName));
        connection.Open();


        PushCommand(string.Format("CREATE TABLE IF NOT EXISTS \"Scores\" (
\"Run\"	INTEGER NOT NULL UNIQUE,
\"Time\"	REAL,
PRIMARY KEY(\"Run\")

)"), connection);
scores.text = “This Worked”;

    IDataReader dataReader = ReadSavedData();

        while (dataReader.Read())
        {

            scores.text += dataReader["Run"] + "			" + dataReader["Time"] + "s

";

        }

        connection.Close();
    }





    void PushCommand(string commandString, IDbConnection connection)
    {
        // Create new command
        IDbCommand command = connection.CreateCommand();
        // Add your comment text (queries)
        command.CommandText = string.Format("{0}", commandString);
        // Execute command reader - execute command
        command.ExecuteReader();
    }

    IDataReader ReadSavedData()
    {
        scores.text = "";
        
        // Create command (query)
        IDbCommand command = connection.CreateCommand();
        // Get all data in Slot = 1 from coordinates table
        command.CommandText = "SELECT * FROM Scores ORDER BY Time LIMIT 7;";
        // Execute command
        IDataReader dataReader = command.ExecuteReader();
        return dataReader;
    }

}

without the error that you get it is hard to tell what goes wrong but my assumption would be that the path

   "URI=file:Assets/Streaming Assets/{0}.db"

is only correct for your Editor version. Reason is that the executable in a built version is in a folder where there is a subfolder called <YourProjectName>_Data in which you can find the StreaminAssets folder.

I’d suggest you use the property Application.streamingAssetsPath as it is described in the Documentation to always have the correct path there instead of hardcoding it to a relative path.