主要代码:
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 (thisuseracctxtTextTrim() == "" && thispswtxtText == "")
{
MessageBoxShow("请输入您的用户名和密码!", "提示!");
return;
}
try
{
string sql;
sql = "select * from tb_user where uacc='" + thisuseracctxtText + "' and upsw='" + thispswtxtText + "'";
OleDbDataReader dr = DBHelpOleReader(sql);
drRead();
if (drHasRows)
{
uacc = thisuseracctxtText;
upsw = thispswtxtText;
uname = dr["uname"]ToString();
usex = dr["usex"]ToString();
upart = dr["upart"]ToString();
uright = dr["uright"]ToString();
MainForm af = new MainForm(this);
thisHide();
thisuseracctxtClear();
thispswtxtClear();
afShow();
}
else
{
MessageBoxShow("账号或密码错误!", "提示!");
thisuseracctxtClear();
thispswtxtClear();
thisuseracctxtFocus();
}
}
catch (Exception)
{
MessageBoxShow("数据库无法连接!", "警告!");
}
}
private void cancelbtn_Click(object sender, EventArgs e)
{
ApplicationExit();
}
private void LoginForm
c#图书管理系统源代码 来自淘豆网www.taodocs.com转载请标明出处.