C#:
using System;
using System.Collections.Generic;
using System.Text;
using MySqlConnector;
using GTANetworkAPI;
namespace AtriumRP
{
class mysql
{
public static MySqlConnection _connection;
public String _host { get; set; }
public String _user { get; set; }
public String _pass { get; set; }
public String _base { get; set; }
public mysql()
{
this._host = "localhost";
this._user = "root";
this._pass = "";
this._base = "atrium";
}
public static void InitConnection()
{
mysql sql = new mysql();
String SQLconnection = $"SERVER={sql._host}; DATABASE={sql._base}; UID={sql._user}; PASSWORD={sql._pass}";
_connection = new MySqlConnection(SQLconnection);
try
{
_connection.Open();
NAPI.Util.ConsoleOutput("Mysql connection successfully");
}
catch(Exception ex)
{
NAPI.Util.ConsoleOutput("Mysql not connected");
NAPI.Util.ConsoleOutput("Exception - " + ex);
}
}
}
}