4
Answers

MySql Connection String

David Smith

David Smith

13y
2.3k
1
Can someone tell me whats wrong with my connection string below thats in the app config. The error I am getting  An Ole DB provider was not specifiied in the connection string. I tried both ways adding the Ole DB provided and i still get am error. Review below.

  <add name="ConnectionString" connectionString="server=xxxx11111;User Id=root;password=mypassword;database=colorDatabase" providerName="MySql.Data.MySqlClient"/>

using (OleDbConnection conn = new OleDbConnection(ConnectionString))
  using (OleDbConnection conn = new OleDbConnection(ConnectionString))
{
  conn.Open(); //Error Occurs

  using (OleDbCommand cm = conn.CreateCommand())
  {
  cm.CommandType = CommandType.StoredProcedure;
  cm.CommandText = "GetColorSerialPartNumber";
  cm.ExecuteReader();

  while (cm.ExecuteReader().Read())
  {
  Console.WriteLine(cm.ToString());
  }

  }

}
Answers (4)