文件名称:.net 简易登陆 利用JSP界面实现
文件大小:129KB
文件格式:RAR
更新时间:2012-06-01 05:06:18
.net 简易登陆 新手上路
简易登陆界面!.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 = ""; } } }
【文件预览】:
登陆
----jjs_Data.MDF(1024KB)
----UserLogin()
--------UserLogin()
--------UserLogin.sln(916B)
--------UserLogin.suo(16KB)
----WebSite1()
--------App_Code()
--------WebSite1.suo(9KB)
--------Default2.aspx(2KB)
--------Web.Config(2KB)
--------App_Data()
--------Default.aspx(2KB)
--------Default.aspx.cs(2KB)
--------Default2.aspx.cs(544B)
--------WebSite1.sln(2KB)
----jjs_Log.LDF(1024KB)