嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
适合C#入门,一个简单的公司物料管理系统
private void connection(string loginName,string password)
{
if (txtLoginName.Text != "")
{
OleDbConnection conn = null;
try
{
conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\\sysManage.mdb");
conn.Open();
string selSql = "select * from login where loginName='" loginName "'";
OleDbCommand cmd = new OleDbCommand(selSql, conn);
OleDbDataReader reader = cmd.ExecuteReader();
if (!reader.HasRows)
{
MessageBox.Show("用户名错误,请重新输入!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.clearText();
this.txtLoginName.Focus();
}
else
{
while (reader.Read())
{
if (password != reader.GetString(2))
{
MessageBox.Show("密码错误!", "登陆提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
// MessageBox.Show("登陆成功!","登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
frmMain main = new frmMain();
main.Show();
this.Hide();
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("打开连接时出现错误!");
}
finally
{
if (conn != null)
conn.Close();
}
}
else
{
MessageBox.Show("请填写登陆名!","登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}