SqlConnection con = new SqlConnection("database connection string");
SqlCommand cmd = new SqlCommand("Select name,address from employee", con);
try
{
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataTable dt = new DataTable();
da.Fill(dt);
DataSet ds = new DataSet("New_DataSet");
ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
da.Fill(dt);
ds.Tables.Add(dt);
ExcelLibrary.DataSetHelper.CreateWorkbook("D:\\Employee.xls", ds);
MessageBox.Show("Exported");
}
catch (Exception ec)
{
MessageBox.Show(ec.Message);
}
using above query when I am exporting data to excel sheet it copies the same date three times in output

Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 5:00 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 2:03 AM EST
Rajneesh ChaubeyRank #1,073 · 1.8K reputationPosted Mar 1, 2018, 2:11 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 2:16 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 2:23 AM EST
Rajneesh ChaubeyRank #1,073 · 1.8K reputationPosted Mar 1, 2018, 2:25 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 2:41 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 2:48 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 2:56 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 2:58 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 3:00 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 3:40 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 4:20 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 4:35 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 4:36 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 5:12 AM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 6:09 AM EST
Shankar M64 reputationPosted Mar 1, 2018, 8:48 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 8:54 PM EST
Shankar M64 reputationPosted Mar 1, 2018, 9:08 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 9:18 PM EST
Shankar M64 reputationPosted Mar 1, 2018, 9:42 PM EST
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 1, 2018, 9:46 PM EST