现在的位置: 首页 > 综合 > 正文

C#中的用户注册验证代码

2012年11月22日 ⁄ 综合 ⁄ 共 349字 ⁄ 字号 评论关闭

  SqlConnection con = new SqlConnection();
        con.Open();
        SqlCommand cmd = new SqlCommand("select count(*) from [User] where [Name]='" + TxtName.Text.Trim() + "'", con);
        int count = (int)cmd.ExecuteScalar();
        con.Close();
        if (count >= 1)
       {

            this.cue.Text = "用户已经被注册";
        }
        else
        {

            this.cue.Text = "用户未被注册";
        }

【上篇】
【下篇】

抱歉!评论已关闭.