Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
My Code as follows;
 
 sql ="select * FROM Tb_SCh_TIme_Table P PIVOT ";
                   sql = sql + "(MAX(Faculty_Code) FOR Session IN ([1],[2],[3] ,[4])) AS PVT ";
                   sql = sql + " where course = '" + dr[0].ToString().Trim() + "' order by date";
                   Xldr = GFun.ReadSql(sql);
                   while (Xldr.Read())
                   {
                       xlWorkSheet.Cells[xlRow, 1] = Xldr[1].ToString();
                       xlWorkSheet.Cells[xlRow, 2] = Xldr[3].ToString();
                       xlWorkSheet.Cells[xlRow, 3] = Xldr[4].ToString();
                       xlWorkSheet.Cells[xlRow, 4] = Xldr[5].ToString();
                       xlWorkSheet.Cells[xlRow, 5] = Xldr[6].ToString();
                       if (Xldr[3].ToString().Trim() == "")
                       {
                           //xlWorkSheet.Cells.Interior.ColorIndex = Color.Red;
                           xlWorkSheet.Cells.Interior.Color = Color.Red;
                       }
                   }
 
i tried the above code. in excel if its empty cell that cell to be filled with some back ground color i tried. but it is not working.
 
Below code is correct ;
 
                     if (Xldr[3].ToString().Trim() == " ")
                      {
                     xlWorkSheet.Cells.Interior.Color = Color.Red;
                      }
 
i tried but is not working .how can i do. from my above code.help me.
Posted 22-Jan-13 1:48am
Edited 22-Jan-13 2:05am
(no name)10.8K
v2
Comments
Ruchin Munjal at 22-Jan-13 16:44pm
   
what is xlWorkSheet? a little background on your components may get you an answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 295
1 DamithSL 295
2 Sergey Alexandrovich Kryukov 197
3 Peter Leow 155
4 Afzaal Ahmad Zeeshan 154
0 OriginalGriff 7,510
1 DamithSL 5,494
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100