日期:2014-05-18  浏览次数:20491 次

头晕哦,哪个头脑清醒的看看是哪里的错误.
代码段:

                        if   (ds.Tables[ "hol "].Rows.Count   >   0)
                        {
                                string   flag   =   ds.Tables[ "hol "].Rows[0][ "FLAG "].ToString();
                                //Response.Write(flag);
                                if   (flag.Equals( "H "))
                                {
                                        cbx.Checked   =   true;
                                        td.CssClass   =   "td_holday ";
                                        Response.Write(flag   +   "-- ");
                                }
                                else   if   (flag.Equals( "N "))
                                {
                                        cbx.Checked   =   true;
                                        td.CssClass   =   "td_tablese ";
                                }
                        }
                        //cbx.Checked   =   true;
                        td.Controls.Add(cbx);

动态table绑定问题.
数据库表中有数据,flag字段有H,N,null三种情况.我多次多位置打印,感觉没有错误.
但是两个if,一个都没执行.哪个指点一下.

------解决方案--------------------
if (flag.Equals( "H "))
else if (flag.Equals( "N "))
-----------------------------------
換成flag.trim()== "H " try一下!!!