Click here to Skip to main content
15,919,774 members

Comments by ajitsit07 (Top 8 by date)

ajitsit07 13-Sep-16 8:56am View    
Can't zip the file, because here are inserting the rows in the temp sheet of excel and further macro will run to use these dumped data and generate the report.
ajitsit07 12-Sep-16 9:06am View    
Here sbColumns contain all the name which is there in excel and sbValues contain all the value. we are inserting the it row by row into the temp sheet of excel. While debuging 'oledbCmd.ExecuteNonQuery();' line taking time.

oledbCmd.CommandText = string.Format("insert into [{0}$]({1})values({2})", tempSheetName, sbColumns.ToString(), sbValues.ToString());
oledbCmd.CommandType = System.Data.CommandType.Text;
// oledbCmd.CommandTimeout = 200;

if (oledbConn.State == System.Data.ConnectionState.Closed)
{
oledbConn.Open();
oledbCmd.Connection = oledbConn;
}
oledbCmd.ExecuteNonQuery();
ajitsit07 12-Sep-16 8:16am View    
Thanks Richard.

Yes, I do agree with you. But optimized code makes difference.
Is there any scope to optimize the above code?
ajitsit07 12-Sep-16 8:15am View    
I need to user macro enabled excel, so can't use .csv.
Is there any scope to optimize the above code?
ajitsit07 12-Sep-16 6:16am View    
There is no problem in the code, i have to improve the speed. so that the excel will get downloaded in less time. Ex. now it is take 40secs and i want to reduce its time to 20 secs.

This excel download in under C#. ASP.net website under a menu.

public static bool fillExcelFile(string filePath, DataSet dataSet, string sheetName, string tempSheetName)

Here: Filepath - is the server mapped path of file (macro enable excel file) available on the server.
Dataset: Contain the data need to insert into the temp sheet of excel.



Do you need any other info. too.