David Smith

David Smith

  • NA
  • 2k
  • 0

MySql Connection String

Feb 7 2012 11:41 PM
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)