0

I connected MySql from XAMPP with Visual Studio Project(I think I have connected it), and I get this error:

System.ArgumentException HResult=0x80070057 Message=Option not supported. Arg_ParamName_Name Source=MySql.Data StackTrace: at MySql.Data.MySqlClient.MySqlConnectionStringBuilder.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.MySqlConnectionStringBuilder..ctor(String connectionString) at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value) at MySql.Data.MySqlClient.MySqlConnection..ctor(String connectionString) at WinFormsApp1.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\Amar\source\repos\WinFormsApp1\WinFormsApp1\Form1.cs:line 30 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam) at Interop.User32.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(UIntPtr dwComponentID, msoloop uReason, Void* pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(msoloop reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(msoloop reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at WinFormsApp1.Program.Main() in C:\Users\Amar\source\repos\WinFormsApp1\WinFormsApp1\Program.cs:line 22

This exception was originally thrown at this call stack: MySql.Data.MySqlClient.MySqlConnectionStringBuilder.GetOption(string) MySql.Data.MySqlClient.MySqlConnectionStringBuilder.this[string].set(string, object) System.Data.Common.DbConnectionStringBuilder.ConnectionString.set(string) MySql.Data.MySqlClient.MySqlConnectionStringBuilder.MySqlConnectionStringBuilder(string) MySql.Data.MySqlClient.MySqlConnection.ConnectionString.set(string) MySql.Data.MySqlClient.MySqlConnection.MySqlConnection(string) WinFormsApp1.Form1.button1_Click(object, System.EventArgs) in Form1.cs System.Windows.Forms.Control.OnClick(System.EventArgs) System.Windows.Forms.Button.OnClick(System.EventArgs) System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs) ... [Call Stack Truncated]

3
  • It might not be able to connect to a MySQL DB hence: This exception was originally thrown at this call stack: MySql.Data.MySqlClient.MySqlConnectionStringBuilder.GetOption(string)
    – CompiledIO
    Commented Apr 13, 2021 at 9:56
  • Message=Option not supported makes me think that one of your connection string options is incorrect. Double-check it for typos and make sure every option and value is spelt correctly. It would also help if you can paste the entire connection string (without password) here. Commented Apr 15, 2021 at 14:10
  • The solution was actually to use .NET Framework instead of .NET Core Windows Application. Don't understand why but magically fixed the problem. (My best guess is, Framework is Windows only so it uses dll which I linked without problems, but Core is cross-platform solution and doesn't seem to handle it well) Commented Apr 20, 2021 at 18:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.