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

  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 = "用户未被注册";
        }

posted @ 2008-05-12 21:21  looky  阅读(2191)  评论(0编辑  收藏  举报