在wpf中绑定checkbox

来源:互联网 发布:联通群发短信软件 编辑:程序博客网 时间:2024/05/02 02:04

 private void InitSourceType()
        {
            string sQuery = string.Format("SELECT sourtype,seqnumbr FROM CRSOURTYPE ORDER BY seqnumbr");
            DataSet dset = gs.GetDataBySql(sQuery);
            if (dset != null && dset.Tables[0].Rows.Count > 0)
            {
                this.cboSourceType.ItemsSource = dset.Tables[0].DefaultView;
                this.cboSourceType.SelectedValuePath = "sourtype";
                this.cboSourceType.DisplayMemberPath = "sourtype";
            }
        }

 

 

      /// <summary>
        /// 根据传入SQL语句取数据
        /// </summary>
        /// <param name="sCommand"></param>
        /// <returns></returns>
        public DataSet GetDataBySql(string sCommand)
        {
            try
            {
                DBOperator db = GetDBOperator(DBName);
                return db.ExecuteQuery(sCommand);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }