Hi,I have used the mentioned method Still it is not working.I have pasted my code here. can you please check and let me know.
private void ExportToCSV()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
con.Open();
SqlDataAdapter da = new SqlDataAdapter("select '00000' + CONVERT(varchar, 0095555)", con);
DataSet ds = new DataSet();
da.Fill(ds);
string Filename = "test";
string sFilePath = HttpRuntime.AppDomainAppPath + Filename;
FileStream fstream = new FileStream(sFilePath, FileMode.Create);
Workbook workBook = new Workbook(fstream);
xlWorksheet = workBook.Worksheets[0];
// xlWorksheet.Cells.ImportDataTable(ds.Tables[0], true, 0, 0, ds.Tables[0].Rows.Count, ds.Tables[0].Columns.Count, false, "dd/MM/yyyy", false);
xlWorksheet.Cells.ImportDataTable(ds.Tables[0],
true, 0, 0, false, false);
xlWorksheet.AutoFitRows();
xlWorksheet.AutoFitColumns();
workBook.Save(
this.Response, Filename + ".csv", ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.CSV));
fstream.Close();
}