I have two data tables and I want to export both data tables as an Excel file having two sheets containing the data of these two data tables.
string myquery = "select * from mytable";
string myquery2 = "select * from blatable";
--making and connection to my db--
try{
cnn.open();
MySqlCommand cmd = new MySqlCommand(myquery, cnn);
{
MySqlDataAdapter sda = new MySqlDataAdapter();
{
sda.SelectCommand = cmd;
mydt = new DataTable();
sda.fill(mydt);
}
}
MySqlCommand cmd1 = new MySqlCommand(myquery2, cnn);
{
MySqlDataAdapter sda = new MySqlDataAdapter();
{
sda.SelectCommand = cmd1;
mydt1 = new DataTable();
sda.fill(mydt1);
}
}
}