文档介绍:图书馆管理信息系统界面与代码
using System;
using ;
using ponentModel;
using ;
using ;
using ;
using ;
using ;
namespace 图书馆管理信息系统
{
public partial class frmLogin : Form
{
public frmLogin()
{
ponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
try
{
if ( == "") //判断用户是否输入了用户名
{
("用户名不能为空");
}
else
{
if ( == "")
{
("密码不能为空"); //判断用户是否输入了密码
}
else
{
SqlConnection con = ();//创建数据库连接
();
mand cmd = new mand("select count(*)from Users where UserName='" + + "' and UserPwd='" + + "'", con);
int i = (()); //获取返回值
if (i > 0)
{
if ( == "")
{
("请选择登录界面");
();
return;
}
else if ( == "普通用户使用界面")
{
frmMain main = new frmMain();
= ;
= ();
();
();//隐藏登录窗体
}
else
{
ptMain ptmain = new ptMain();
= ;
();
();
}
}
else
{
("用户名或者密码错误!"); //弹出提示
}
}
}
}
catch (Exception ex)
{
(());
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
();
}
private void txtPwd_KeyPress(object sender, KeyPressEventArgs e)
{
if ( == 13) //判断是否按下Enter键
{
btnLogin_Click(sender, e); //调用“登录”按钮的Click事件
}
}
}
}
using System;
using ;
using ;
using ;
namespace 图书馆管理信息系统
{
class DBCon
{
public static SqlConnection createCon()
{
//SqlConnection con = new SqlConnection("server=yyw;database=LibDB;uid=sa;pwd=' '");
SqlConnection con = new SqlConnection("workstation id=