当前位置:编程学习 > C#/ASP.NET >>

求个用户注册的代码C#

button1注册
textBox1用户名
textBox2密码
数据库表名ID_info
列  uid   pwd
求详细 --------------------编程问答-------------------- refer : http://blog.sina.com.cn/s/blog_7ed9cfb80100xnt7.html --------------------编程问答-------------------- 。。。建议楼主还是别当程序员了 --------------------编程问答-------------------- http://bbs.csdn.net/topics/310083160

http://wenwen.soso.com/z/q203400536.htm

和你一样的人多了去,不会写程序不怪你,不会用Google么? --------------------编程问答--------------------  private void button1_Click(object sender, EventArgs e)
        {
            using (SqlConnection connection = new SqlConnection(@"Data Source=61.180.188.132;Initial Catalog=liuqiang;User ID=liuqiang;Password=d5a6h7z4"))
            {
                try
                {
                    connection.Open();
                    SqlCommand sqlText = new SqlCommand("insert into ID_info values (@uid,@pwd)", connection);
                    sqlText.Parameters[0].Value = textBox1.Text;
                    sqlText.Parameters[1].Value = textBox2.Text;
                    if (sqlText.ExecuteNonQuery())
                        MessageBox.Show(this, "注册失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    else
                        MessageBox.Show(this, "恭喜您,注册成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                catch (SqlException exception)
                {
                    MessageBox.Show(this, "注册失败:\n" + exception.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
                finally
                {
                    connection.Close();
                }
            }
        } --------------------编程问答--------------------  private void button1_Click(object sender, EventArgs e)
        {
            using (SqlConnection connection = new SqlConnection(@"Data Source=61.180.188.132;Initial Catalog=liuqiang;User ID=liuqiang;Password=d5a6h7z4"))
            {
                try
                {
                    connection.Open();
                    SqlCommand sqlText = new SqlCommand("insert into ID_info values (@uid,@pwd)", connection);
                    sqlText.Parameters[0].Value = textBox1.Text;
                    sqlText.Parameters[1].Value = textBox2.Text;
                    if (sqlText.ExecuteNonQuery())
                        MessageBox.Show(this, "注册失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    else
                        MessageBox.Show(this, "恭喜您,注册成功!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                catch (SqlException exception)
                {
                    MessageBox.Show(this, "注册失败:\n" + exception.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
                finally
                {
                    connection.Close();
                }
            }
        }

哪不对啊 --------------------编程问答-------------------- 直接要代码就是你的不对了!网上随便找一大堆!百度你都懒的用 --------------------编程问答-------------------- 走出宿舍到图书馆 --------------------编程问答-------------------- 懒成这样,要饭都要不到。
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,