GetRowCount() public method

获得符合该Sql语句的表记录数
public GetRowCount ( string strSQL ) : int
strSQL string
return int
Esempio n. 1
0
    string strRunPage; //验证成功后要跳转的页面

    #endregion Fields

    #region Methods

    protected void btnCheck_Click(object sender, ImageClickEventArgs e)
    {
        DataConn dc = new DataConn();
        string QQ = Request.Form["user_qq"];
        string gys_qq_id;
        string cgs_qq_id;
        string sql_Check_QQ;
        string sql_Update_QQ_id;
        string sql_GetData;
        string sql_Level;
        string sql_dwid;

        if (Request.Cookies["GYS_QQ_ID"]!=null)
        {
            gys_qq_id = Request.Cookies["GYS_QQ_ID"].Value.ToString();
            sql_Check_QQ = "select * from 用户表 where QQ号码='" + QQ + "'";
            sql_Update_QQ_id = "update 用户表 set QQ_id = '" + gys_qq_id + "',验证通过时间=getdate(),是否验证通过='通过' where QQ号码='" + QQ + "'";

            sql_GetData = "select 供应商,地址,电话,主页,单位类型,联系人,联系人手机 from 材料供应商信息表 where gys_id=(select dw_id from 用户表 where QQ_id='" + gys_qq_id + "')";

            sql_Level = "select 等级 from 用户表 where QQ_id='" + gys_qq_id + "'";
            sql_dwid = "select dw_id from 用户表 where QQ_id='" + gys_qq_id + "'";
        }
        else
        {
            cgs_qq_id = Request.Cookies["CGS_QQ_ID"].Value.ToString();
            sql_Check_QQ = "select * from 用户表 where QQ号码='" + QQ + "'";
            sql_Update_QQ_id = "update 用户表 set QQ_id = '" + cgs_qq_id + "',验证通过时间=getdate(),是否验证通过='通过' where QQ号码='" + QQ + "'";

            sql_GetData = "select 单位名称,地址,电话,主页,单位类型,联系人,联系人手机 from 采购商基本信息 where cgs_id=(select dw_id from 用户表 where QQ_id='" + cgs_qq_id + "')";

            sql_Level = "select 等级 from 用户表 where QQ_id='" + cgs_qq_id + "'";
            sql_dwid = "select dw_id from 用户表 where QQ_id='" + cgs_qq_id + "'";
        }

        if(dc.GetRowCount(sql_Check_QQ)>0)     //判断QQ号是否存在,即是否已经注册
        {
            //Response.Write("已经注册");
            if (dc.RunSqlTransaction(sql_Update_QQ_id))    //已经注册,则写入QQ_id
            {
                //读取数据
                dtGys = dc.GetDataTable(sql_GetData);
                if (Request.Cookies["GYS_QQ_ID"] != null)
                {
                    for (int i = 0; i < dtGys.Rows.Count; i++)
                    {
                        DataRow dr = dtGys.Rows[i];
                        this.gys_name.Value = dr["供应商"].ToString();
                        this.gys_address.Value = dr["地址"].ToString();
                        this.gys_phone.Value = dr["电话"].ToString();
                        this.gys_homepage.Value = dr["主页"].ToString();
                        this.gslx.Value = dr["单位类型"].ToString();
                        this.user_name.Value = dr["联系人"].ToString();
                        this.user_phone.Value = dr["联系人手机"].ToString();
                    }
                }
                else
                {
                    for (int i = 0; i < dtGys.Rows.Count; i++)
                    {
                        DataRow dr = dtGys.Rows[i];
                        this.gys_name.Value = dr["单位名称"].ToString();
                        this.gys_address.Value = dr["地址"].ToString();
                        this.gys_phone.Value = dr["电话"].ToString();
                        this.gys_homepage.Value = dr["主页"].ToString();
                        this.gslx.Value = dr["单位类型"].ToString();
                        this.user_name.Value = dr["联系人"].ToString();
                        this.user_phone.Value = dr["联系人手机"].ToString();
                    }
                }

                if (dc.DBLook(sql_Level) == "企业用户")
                {
                    strRunPage = "hyyhgl.aspx";
                }
                else if (dc.DBLook(sql_Level) == "普通用户")
                {
                    string dwid = dc.DBLook(sql_dwid);
                    if (Request.Cookies["GYS_QQ_ID"] != null)
                    {
                        strRunPage = "gyszym.aspx?dw_id=" + dwid;
                    }
                    else
                    {
                        strRunPage = "cgsgl_2.aspx?dw_id=" + dwid;
                    }

                }

                Response.Write(@"<script>if(confirm('验证成功,是否现在登录?')==true)
                {window.location.href='" + strRunPage + "';}else{}</script>");

            }
        }
        else
        {
            Response.Write(@"<script>if(confirm('此账户尚未注册,是否现在注册?')==true)
            {window.location.href='hyzcsf.aspx';}else{window.opener=null;window.open('','_self');
            window.close();}</script>");
        }
    }
Esempio n. 2
0
    protected void Submit1_Click(object sender, ImageClickEventArgs e)
    {
        DataConn dc = new DataConn();
        string sqlIsExistQQ = "select * from 用户表 where QQ号码='" + this.txt_gsQQ.Value + "' ";
        string sqlIsExistGs = "select * from 采购商基本信息 where 单位名称='" + this.txt_gsmc.Value.Trim() + "' ";

        qymc = this.region.Value;

        if (string.IsNullOrEmpty(this.txt_gsmc.Value)&&this.txt_gsmc.Value==""&&this.txt_gsmc.Value=="请填写工商局注册的全称(4-40位字符)")
        {
            Response.Write("<script>alert('请输入公司名称!');</script>");
            this.txt_gsmc.Focus();
            return;
        }
        else
        {
            if (dc.GetRowCount(sqlIsExistGs) > 0)
            {
                Response.Write("<script>alert('该公司已注册,请联系公司管理员');</script>");
                Response.Write("<script>javascript:window.location.href='index.aspx'</script>");
            }
        }
        if (string.IsNullOrEmpty(this.txt_gsQQ.Value) && this.txt_gsmc.Value == "请填写工商局注册的全称(4-40位字符)")
        {
            Response.Write("<script>alert('请输入公司QQ')</script>");
            this.txt_gsQQ.Focus();
            return;
        }
        else
        {
            if (dc.GetRowCount(sqlIsExistQQ) > 0)
            {
                Response.Write("<script>alert('QQ已存在');</script>");
                this.txt_gsQQ.Focus();
                return;
            }
        }
        if (string.IsNullOrEmpty(this.txt_yyzzzch.Value) && this.txt_yyzzzch.Value == "")
        {
            Response.Write("<script>alert('请输入营业执照注册号');</script>");
            this.txt_yyzzzch.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_zcrq.Value) && this.txt_zcrq.Value == "")
        {
            Response.Write("<script>alert('请输入公司注册日期');</script>");
            this.txt_zcrq.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_zczj.Value) && this.txt_zczj.Value == "")
        {
            Response.Write("<script>alert('请输入注册资金');</script>");
            this.txt_zczj.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.dwlx.Value) && this.dwlx.Value == "")
        {
            Response.Write("<script>alert('请选择单位类型');</script>");
            this.dwlx.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_gsdz.Value) && this.txt_gsdz.Value == "")
        {
            Response.Write("<script>alert('请输入公司地址');</script>");
            this.txt_gsdz.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_gsdh.Value) && this.txt_gsdh.Value == "")
        {
            Response.Write("<script>alert('请输入公司电话');</script>");
            this.txt_gsdh.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.jyfw.Value) && this.jyfw.Value == "")
        {
            Response.Write("<script>alert('请输入经营范围');</script>");
            this.jyfw.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_xm.Value) && this.txt_xm.Value == "")
        {
            Response.Write("<script>alert('请输入联系人姓名');</script>");
            this.txt_xm.Focus();
            return;
        }
        if (string.IsNullOrEmpty(this.txt_sj.Value) && this.txt_sj.Value == "")
        {
            Response.Write("<script>alert('请输入联系人手机号');</script>");
            this.txt_sj.Focus();
            return;
        }
        //if (string.IsNullOrEmpty(this.txt_lxdz.Value))
        //{
        //    Response.Write("<script>alert('请输入联系人地址');</script>");
        //    this.txt_lxdz.Focus();
        //    return;
        //}

            string sqlAddGys = "insert into 采购商基本信息 (单位名称,主页,地址,电话,传真,联系人,联系人手机,是否启用,单位类型,单位简称,地区名称,法定代表人,注册资金,邮编,电子邮箱,开户银行,银行账户,账户名称,资质等级,经营范围,备注,注册日期,企业员工人数,资产总额,注册级别,企业类别,营业执照注册号,updatetime,单位QQ号)"
            + " values ('" + this.txt_gsmc.Value.Trim() + "','" + this.txt_gszy.Value + "','" + this.txt_gsdz.Value + "','" + this.txt_gsdh.Value + "','" + this.txt_gscz.Value + "','" + this.txt_xm.Value + "','" + this.txt_sj.Value + "',1,'" + this.dwlx.Value + "','" + this.txt_gsjc.Value + "','" + qymc + "','" + this.txt_fddbr.Value + "','" + this.txt_zczj.Value + "','" + this.txt_gsyb.Value + "','" + this.txt_yx.Value + "','" + this.txt_khyh.Value + "','" + this.txt_yhzh.Value + "','" + this.txt_zhmc.Value + "','" + this.zzdj.Value + "','" + this.jyfw.Value + "','" + this.txt_bz.Value + "','" + this.txt_bz.Value + "','" + this.txt_qyrs.Value + "','" + this.txt_zcze.Value + "','" + this.zcjb.Value + "','" + this.qylb.Value + "','" + this.txt_yyzzzch.Value + "', GETDATE(),'" + this.txt_gsQQ.Value + "')";

            string sqlAddGys_id = "update 采购商基本信息 set cgs_id=myID where 单位QQ号='" + this.txt_gsQQ.Value + "';";

            string sqlAll = sqlAddGys + sqlAddGys_id;

            bool a = dc.RunSqlTransaction(sqlAll);
            if (a)
            {
                Response.Write("<script>alert('注册信息已提交,请等待审核');</script>");
                Response.Write("<script>javascript:window.location.href='index.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('注册失败');</script>");
                return;
            }
    }