資源簡介
源代碼,一看就知道!開頭部分,下面的自己下載下來看吧!
public partial class LoginForm : Form{
public static string uacc;
public static string upsw;
public static string uname;
public static string usex;
public static string upart;
public static string uright;
public LoginForm()
{
InitializeComponent();
}
private void loginbtn_Click(object sender, EventArgs e)
{
if (this.useracctxt.Text.Trim() == "" && this.pswtxt.Text == "")
{
MessageBox.Show("請輸入您的用戶名和密碼!", "提示!");
return;
}
try
{
string sql;
sql = "select * from tb_user where uacc='" + this.useracctxt.Text + "' and upsw='" + this.pswtxt.Text + "'";
OleDbDataReader dr = DBHelp.OleReader(sql);
dr.Read();
if (dr.HasRows)
{
uacc = this.useracctxt.Text;
upsw = this.pswtxt.Text;
uname = dr["uname"].ToString();
usex = dr["usex"].ToString();
upart = dr["upart"].ToString();
uright = dr["uright"].ToString();
MainForm af = new MainForm(this);
this.Hide();
this.useracctxt.Clear();
this.pswtxt.Clear();
af.Show();
}
else
{
MessageBox.Show("賬號或密碼錯誤!", "提示!");
this.useracctxt.Clear();
this.pswtxt.Clear();
this.useracctxt.Focus();
}
}
catch (Exception)
{
MessageBox.Show("數據庫無法連接!", "警告!");
}
}
private void cancelbtn_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Logi
代碼片段和文件信息
評論
共有 條評論