Bonjour

J ai un probleme avec le connector mysql pour mono,

J ai un projet existant dont j ai travailler dessus il y a 6 mois et je n arrive pas a ouvrir une connection mysql, Mon user est bien dans le group mySql,

j ai essayer de mettre toute la solution a du 2.0 avant en 3.5; marche po

truc de bizarre je me part une nouvelle appli console avec ce code et j ouvre la connection sans probleme.

a oui la dll mysql,data,dll a ete renome en MySql,Data,dll et a ete ajouter dans le gac

Ca me tente vraiment pas de recommencer la solution,

le probleme peut venir d ou selon vous? car la je suis decourager et je ne trouve plus,

le code causant le probleme
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
string connectionString =
          "Server=localhost;" +
          "Database=taskmanager;" +
          "User ID=root;" +
          "Password=passdelamortquitue;" +
          "Pooling=false";
       IDbConnection dbcon;
       dbcon = new MySqlConnection(connectionString);
       dbcon.Open();
l exception
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Unhandled Exception: MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.Dns ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.Sockets.Socket ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.Xml.XmlException: Document element did not appear.  Line 1, position 1.
  at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlReader.MoveToContent () [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.Load () [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.Init (IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.CheckProtocolSupport () [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Net.Dns..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at MySql.Data.Common.StreamCreator.GetDnsHostEntry (System.String hostname) [0x00000] in <filename unknown>:0 
  at MySql.Data.Common.StreamCreator.GetHostEntry (System.String hostname) [0x00000] in <filename unknown>:0 
  at MySql.Data.Common.StreamCreator.GetStream (UInt32 timeout) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.Driver.Open () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] in <filename unknown>:0

Merci pour votre aide