源码C#登录注册小程序源码(3)

2020-12-29 23:48

简单易懂方便coppy

}

if (flagRegister == true) //确认用户注册后,把用户写入数据库

{

SqlConnection conConnection = new SqlConnection(strConnect);

conConnection.Open();

string cmd = "insert into 用户(用户名,密码,email) values ('" + textBox1.Text + "'," + "'" + textBox2.Text + "'," + "'" + textBox3.Text + "') ";

SqlCommand com = new SqlCommand(cmd, conConnection);

com.ExecuteNonQuery();

conConnection.Close();

MessageBox.Show("注册成功!点击确定,返回登录界面。", "提示");

this.Close();

Form1 f1 = new Form1();

http://www.77cn.com.cnbel2.Text = "欢迎你," + textBox1.Text;

http://www.77cn.com.cnbel1.Visible = false;

http://www.77cn.com.cnbel3.Visible = false;

f1.linkLabel1.Visible = false;

f1.linkLabel2.Visible = false;

http://www.77cn.com.cnbel2.Visible = true;

f1.Show();

}

}

public bool UserFlag; //定义标志位,来确认用户是否存在

private void textBox1_TextChanged(object sender, EventArgs e)

{

SqlConnection conConnection = new SqlConnection(strConnect);

conConnection.Open();

string cmd = "select 用户名 from 用户";

SqlCommand com = new SqlCommand(cmd, conConnection);

SqlDataReader readerUser = com.ExecuteReader();

while (readerUser.Read())

{

if (textBox1.Text == readerUser["用户名"].ToString().Trim())

{

label5.Text = "用户已存在,请重新输入!";

UserFlag = true;

//textBox1.Text = "";

return;

}

else if (textBox1.Text != readerUser["用户名"].ToString().Trim())


源码C#登录注册小程序源码(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2015-2020年中国烤管机市场研究及市场评估报告

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: