Click here to Skip to main content
11,478,642 members (64,121 online)
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
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 Sergey Alexandrovich Kryukov 209
1 F-ES Sitecore 170
2 Frankie-C 120
3 OriginalGriff 105
4 DamithSL 95
0 Sergey Alexandrovich Kryukov 7,865
1 OriginalGriff 7,341
2 Sascha Lefèvre 3,059
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2015
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