简易登陆界面!.NET 请高手多多指教 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace UserLogin { public partial class Form1 : Form { private String userName = ""; public String UserName { get { return userName; } //set { userName = value; } } public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != null && !textBox1.Text.Equals("")) { if (textBox2.Text != null && !textBox2.Text.Equals("")) { SqlConnection conn = Conn.GetConn("jjs"); conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "select * from UserTable where UserName='" + textBox1.Text + "' and UserPass='" + textBox2.Text + "'"; DataTable dt = new DataTable(); dt.Load(cmd.ExecuteReader()); if (dt.Rows.Count > 0) { this.DialogResult = DialogResult.Yes; this.userName = "'"+textBox1.Text+"'"; this.Close(); } else { MessageBox.Show("没有数据?", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } conn.Close(); } else { MessageBox.Show("密码不为空?", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("用户名不为空?", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } private void button2_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; } } }
- 1
- 粉丝: 0
- 资源: 4
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2%EF%BC%9A%E9%99%95%E8%A5%BF%E
- yyspdz62_944.apk
- SAP公司间采购EDI配置-如何触发自动MIRO.docx
- python197基于图像识别的仪表实时监控系统.rar
- I2C驱动SHT30温湿度传感器和LCD12864使用例程(RSCG12864B)
- python193中学地理-中国的江河湖泊教学网(django).rar
- python191基于时间序列分析的大气污染预测软件(django).rar
- python190基于人脸识别智能化小区门禁管理系统.rar
- python189某医院体检挂号系统.rar
- python179的企业物流管理系统(django).rar