Last post Aug 31, 2011 08:51 AM by Roberto Goves
Aug 30, 2011 02:44 PM|link224444|LINK
I was wondering if anyone knows how to drop a MySQL Database into Excelsheet(s) through the MySQL Command Line.
Aug 31, 2011 08:51 AM|Roberto Goves|LINK
I've used Excel component from
devtriogroup.com. Using it you will be able to
export data from MySQL to EXCEL easily.
Here's a sipet of my c# code:
// create an excel file
var wb = new DTG.Spreadsheet.ExcelWorkbook();
var excel = wb.Worksheets.Add("Sheet1");
// database connection
string MyConString = "SERVER=localhost;" +
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
command.CommandText = "select * from mycustomers";
Reader = command.ExecuteReader();
// Fill the excel worksheet
int row = 0;
for (int col = 0; col < Reader.FieldCount; col++)
excel.Cells[row, col].Value = Reader.GetValue(i).ToString();
Hope it will help you.