invalid cell value Error when reading in data from MySql using c#

266
February 03, 2017, at 05:53 AM

I am trying to read in some data from MySql database using C# using MySqlDataAdapter. Below is my code:

private MySqlConnection connection;
private string ConnectionString;
public void MySqlConnectionHandler(string SQL_QUERY)
{
    try
    {
        ConnectionString = " SERVER = 127.0.0.1;"
                           + "DATABASE = my_database;" 
                           + "UID=uid;"
                           + "PASSWORD=password";
        connection = new MySqlConnection(ConnectionString);
        MySqlDataAdapter dataAdapter = new MySqlDataAdapter();
        dataAdapter.SelectCommand = new MySqlCommand(SQL_QUERY,connection);
        MySqlCommandBuilder cb = new MySqlCommandBuilder(dataAdapter);
        connection.Open();
        DataSet dbdataset = new DataSet();
        dataAdapter.Fill(dbdataset);
        DataSetHelper.CreateWorkbook("MyExcelFile.xls", dbdataset);
        connection.Close();
        MessageBox.Show("Connected");
    }
    catch (MySqlException ex)
    {
        MessageBox.Show(ex.Message, "MySQL Query Failure");
    }
}

The invalid cell value error occurs when DataSetHelper.CreateWorkbook("MyExcelFile.xls", dbdataset); is run. I have checked the connection to the database and it was fine, so I am not sure what is the exact problem.

READ ALSO
Trying to save special characters in MySQL DB

Trying to save special characters in MySQL DB

I have a string that looks like this

215
Using Same Customer ID naming in DB with different Clients

Using Same Customer ID naming in DB with different Clients

I am looking for a better Customer ID numbering strategy than the competition has as they add a sequential strategy that no matter what the client ID is the numbering is continuousSo they may have a UCID that is not relevant to location, but only unique...

163
User based rating system for my website

User based rating system for my website

I am making a website like 9gag and I want to make a user rating system for itI use mysql

221
Copying million rows of data from one database to another on laravel

Copying million rows of data from one database to another on laravel

Using Laravel Eloquent, i'm copying 7Million rows of data from one table on my old Mysql database and putting these rows on different tables on my new Mysql databaseThe problem is that it took almost one day to perform this and i need to re-perform this action...

314