How do you use MySQL with C# in FiveM?

I just started using c# in fivem and i have no clue how to use mysql in c#. I’ve used lua before but don’t know how to do it in c#.

I’m currently using this https://www.nuget.org/packages/MySql.Data/

connection example

public static void TestConnection()
{
    try {
        using(MySqlConnection connection = new MySqlConnection(connStr))
        {
            Debug.WriteLine("Connecting to MySQL Database...");
            connection.Open();

            if(connection.State == ConnectionState.Open) {
                Debug.WriteLine("DATABASE: Connected to MySQL Server.");
            }
        }
    }
    catch(Exception ex) {
        Debug.WriteLine($"[EXCEPTION - TestConnection] {ex.Message}");
        Debug.WriteLine($"[EXCEPTION - TestConnection] {ex.StackTrace}");
    }
}

do you know why i get this error?

That error is possibly due to missing MySQL drivers.

Anyway, I suggest you to use MySqlConnector by Bradley Grainger, in combination with Dapper, much better than the official MySql package.