Jump to content
RAGE Multiplayer Community

Recommended Posts

Hello! 

I tried to connect to the DB, but the server threw an error.

CS0012: The type 'DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
       -> MySQL/MySQL.cs:37

When i add a reference I get it:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Option not supported.
Parameter name: db
   at MySql.Data.MySqlClient.MySqlBaseConnectionStringBuilder.GetOption(String key)
   at MySql.Data.MySqlClient.MySqlConnectionStringBuilder.set_Item(String keyword, Object value)
   at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
   at MySql.Data.MySqlClient.MySqlBaseConnectionStringBuilder..ctor(String connStr, Boolean isXProtocol)
   at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value)
   at MySQL.MySQL.StartConnection() in MySQL/MySQL.cs:line 35
   at VesRP.Setts() in VesRP.cs:line 11
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at GTANetworkInternals.ScriptingEngine.InvokeVoidMethod(String method, Object[] args)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at GTANetworkInternals.EventHandler.ParseEx(Event _event, ScriptingEngine engine, Object[] arguments)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at GTANetworkInternals.GameServer.StartResource(String resourceName, String parent)

 

MySQL connection code:

String SQLConnection = $"SERVER={sql.Host};PASSWORD={sql.Pass};UID={sql.User};DATABASE={sql.DB};";
conn = new MySqlConnection(SQLConnection);
try
{
  conn.Open();
  NAPI.Util.ConsoleOutput("Connected!");
}
catch(Exception ex)
{
  NAPI.Util.ConsoleOutput("Error:"+ex.ToString());
}

 

Edited by Daniel Clark
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...