-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: subramanyacr
Message 5 in Discussion
Hi Vijay
I have an additional comment to your code.
1. Avoid String concatenation within loop, it's most time consuming.
ex: ((Excel.Range)sheet.Cells[i+2,j]).Value2 ="'" +
odt.Rows[i-1].ItemArray[j-1].ToString();
2. Next point as already suggested by "Rama Pallavi" avoid casting within loop.
I am sorry not sure about the available methods.
3. Avoid if condition (j==1) inside loop, because you are sure for column
number 1 the value is 'i'. Start the second loop with 2.
ex:
/ for(int i = 1 ; i <= odt.Rows.Count ; i++)
/ {
/ ((Excel.Range)sheet.Cells[i+2,1]).Value2 = i;
/
/ for(int j = 2 ; j < odt.Columns.Count+1 ; j++ )
/ {
/ //This is to add the Data which retrieved from the
/ //database into your Excel Sheet.
/
/ ((Excel.Range)sheet.Cells[i+2,j]).Value2 =
odt.Rows[i-1].ItemArray[j-1].ToString();
/
/ }
/ }
Happy coding.
Regards,
Subramanya
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]