I am working on a project where I am getting values from a series of unknown of database schemas, i.e. the user can enter any database connection details and my program will retrieve the data so I am not going to know the type of tables used and what's stored in them.
At the moment when I try and get the values and store them all in a string so they can be written to a file, but one of the fields I am testing on has a Timestamp value and when I try to store this in the string variable I get the error Unable to convert MySQL date/time value to System.DateTime, I've tried saying .toString() but it doesn't seem to make any difference.
Below is the code I am using to retrieve the data
using (ConnectMySQLDB db = new ConnectMySQLDB(databaseSettings))
{
   string query = string.Format("SELECT * FROM {0}.{1}", database, table);
   using (MySqlCommand cmd = new MySqlCommand(query, db.conn))
   {
      using (MySqlDataReader reader = cmd.ExecuteReader())
      {
         while (reader.Read())
         {
            fieldsAndValues = new Dictionary<string, string>();
            foreach (string field in fields)
            {
               fieldsAndValues.Add(field, reader.GetString(field));
            }
            rows.Add(fieldsAndValues);
         }
      }
   }
}
Thanks for any help you can provide.
 
     
     
    