找回密码
 立即注册

QQ登录

只需一步,快速开始

victorysoft

高级会员

40

主题

100

帖子

1040

积分

高级会员

积分
1040

活字格认证

victorysoft
高级会员   /  发表于:2013-1-22 08:40  /   查看:4698  /  回复:2
需求如题,数据库里 选中状态在库中存的是“1”,未选中是 NULL 或者 “0”。请给出代码示例。谢谢

2 个回复

倒序浏览
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2013-1-22 09:08:00
沙发
不知以下代码是否是你想要的功能:
  1.     // 数据源
  2.     System.Data.DataTable dt = new System.Data.DataTable();
  3.     dt.Columns.Add("Col1");
  4.     dt.Rows.Add("1");
  5.     dt.Rows.Add("0");
  6.     dt.Rows.Add("");
  7.     dt.Rows.Add("1");

  8.     // 设置数据源
  9.     FpSpread1.DataSource = dt;
  10.                
  11.     // 设置CheckBoxCellTyp类型
  12.     FarPoint.Web.Spread.CheckBoxCellType cbct = new FarPoint.Web.Spread.CheckBoxCellType();
  13.     FpSpread1.ActiveSheetView.Columns[0].CellType = cbct;
复制代码
回复 使用道具 举报
飞时
论坛元老   /  发表于:2013-1-22 09:13:00
板凳
FpSpread1.SaveChanges();
        for (int j = 0; j <= dt.Rows.Count - 1; j++)
        {

                //FpSpread1.Cells[j, (int)Col.选择].Value = "1";

                //FpSpread1.Cells[j, (int)Col.选择].Value = "0";
            
                FpSpread1.Cells[j, (int)Col.选择].Value = dt.Rows["CDEPCODE"].ToString() ;//你要赋的值
      }
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部