Linux上使用MySql连接器的.Net应用程序

时间:2013-08-26 06:00:43

标签: c# mysql linux connector

我正在创建一个使用MySql.Data.dll连接数据库的应用程序。它在Windows上工作正常,但拒绝在Linux上工作(在Centos和Fedora上试过)。我已经尝试在Visual C#Express和MonoDevelop上进行编译,在dll上下载另一个版本,使得项目.Net 2.0 ......没有用。

我收到以下错误:

  

未处理的例外情况:   System.ArgumentException:初始化字符串的格式不符合索引73处的规范。     在/usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:771中的System.Data.Common.DbConnectionStringBuilder.ParseConnectionStringNonOdbc(System.String connectionString)[0x00401]     在/usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:531中的System.Data.Common.DbConnectionStringBuilder.ParseConnectionString(System.String connectionString)[0x00017]     在/usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:97中的System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(System.String value)[0x0001e]     在MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor(System.String connStr)[0x00000] in:0     at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(System.String value)[0x00000] in:0     在MySql.Data.MySqlClient.MySqlConnection..ctor(System.String connectionString)[0x00000] in:0     at(wrapper remoting-invoke-with-check)MySql.Data.MySqlClient.MySqlConnection:.ctor(string)     在Plate.MySQLConnection.Select(System.Windows.Forms.DataGridView& _dataGrid,System.String [] select,System.String from,Plate.FieldValue [] where,System.String [] order_by)[0x0000f] in / home / ukus /桌面/ MonoDev /地点/ MySQLConnection.cs:241     at Plate.GlavniForm.ReloadMeseci()[0x0006f] in /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:43     在Plate.GlavniForm..ctor()[0x00020] /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:28     at(wrapper remoting-invoke-with-check)Plate.GlavniForm:.ctor()     at Plate.Program.Main()[0x0000c] in /home/ukus/Desktop/MonoDev/Place/Program.cs:18   [ERROR]致命的UNHANDLED EXCEPTION:System.ArgumentException:初始化字符串的格式不符合索引73处的规范。     在/usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:771中的System.Data.Common.DbConnectionStringBuilder.ParseConnectionStringNonOdbc(System.String connectionString)[0x00401]     在/usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:531中的System.Data.Common.DbConnectionStringBuilder.ParseConnectionString(System.String connectionString)[0x00017]     在/usr/src/mono/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs:97中的System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(System.String value)[0x0001e]     在MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor(System.String connStr)[0x00000] in:0     at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(System.String value)[0x00000] in:0     在MySql.Data.MySqlClient.MySqlConnection..ctor(System.String connectionString)[0x00000] in:0     at(wrapper remoting-invoke-with-check)MySql.Data.MySqlClient.MySqlConnection:.ctor(string)     在Plate.MySQLConnection.Select(System.Windows.Forms.DataGridView& _dataGrid,System.String [] select,System.String from,Plate.FieldValue [] where,System.String [] order_by)[0x0000f] in / home / ukus /桌面/ MonoDev /地点/ MySQLConnection.cs:241     at Plate.GlavniForm.ReloadMeseci()[0x0006f] in /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:43     在Plate.GlavniForm..ctor()[0x00020] /home/ukus/Desktop/MonoDev/Place/GlavniForm.cs:28     at(wrapper remoting-invoke-with-check)Plate.GlavniForm:.ctor()     at Plate.Program.Main()[0x0000c] in /home/ukus/Desktop/MonoDev/Place/Program.cs:18

应用程序在Visual C#Express和MonoDevelop上成功构建。

1 个答案:

答案 0 :(得分:0)

我发现了问题。由于连接字符串,该应用程序无法在Linux上运行。问题可能在于Mono不等同于.Net。