SammyD86 Posted July 15, 2019 Share Posted July 15, 2019 Hi , I'm trying a mysql connection for my server, but it stops and shuts down as soon as the event is called. What could this be? does anyone know advice? Is the database configuration so correct? I use the bridge server c # and client js on Server c# [RemoteEvent("register2")] public void Register2(Client player, string username, string password) { Databasesql.Query($"INSERT INTO Playerdata(Username,Password) VALUES ('{username}','{password}')"); } and the database config c# public static class Databasesql { public static string myConnectionString = "SERVER=localhost;Database=gtav;UID=gta;PASSWORD=gtatest;"; public static long Query(string Query) { using (var conn = new MySqlConnection(myConnectionString)) { try { conn.Open(); var cmd = conn.CreateCommand(); cmd.CommandText = Query; cmd.ExecuteNonQuery(); conn.Close(); return cmd.LastInsertedId; } catch (MySqlException ex) { NAPI.Util.ConsoleOutput($"[Database][Error] {ex.Message}"); return -1; } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now