コード例 #1
0
        private void BindPlatformList()
        {
            DataTable dt = PfManage.GetTable(" Pf_del = 0 ORDER BY Pf_sort asc", null);

            gvPlatform.DataSource = dt;
            gvPlatform.DataBind();
        }
コード例 #2
0
        /// <summary>
        /// 判断平台名称是否存在
        /// </summary>
        /// <returns></returns>
        private bool CheckPlatformName()
        {
            //if (PfManage.GetTable(string.Format(" Pf_name = '{0}' AND Pf_name = 0", this.txtPfname.Text.Trim())).Rows.Count > 0)
            IList <MySqlParameter> parm     = new List <MySqlParameter>();
            StringBuilder          strWhere = new StringBuilder();

            strWhere.Append("  Pf_name =@Pf_name AND Pf_name = 0 ");
            parm.Add(new MySqlParameter("@Pf_name", this.txtPfname.Text.Trim()));
            if (PfManage.GetTable(strWhere.ToString(), parm).Rows.Count > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #3
0
        private void BindPlatform()
        {
            PlatformManage PlatformManage = new PlatformManage();
            StringBuilder  strWhere       = new StringBuilder();

            strWhere.Append(" 1=1");
            IList <MySqlParameter> parm = new List <MySqlParameter>();

            if (!string.IsNullOrEmpty(this.txtPfname.Text.Trim()))
            {
                //strWhere.Append(" And Pf_name LIKE '%" + txtPfname.Text.Trim() + "%' ");
                strWhere.Append("  And Pf_name LIKE @Cnname");
                parm.Add(new MySqlParameter("@Cnname", "%" + this.txtPfname.Text.Trim() + "%"));
            }
            strWhere.Append(" And Pf_del = 0 ORDER BY Pf_sort asc");
            this.ddlPf.DataSource     = PlatformManage.GetTable(strWhere.ToString(), parm);
            this.ddlPf.DataTextField  = "Pf_name";
            this.ddlPf.DataValueField = "Pf_id";
            this.ddlPf.DataBind();
        }