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.OleDb;
namespace 企业网管软件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
string str = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=QyWg.mdb;";
OleDbConnection con;
private void button1_Click(object sender, EventArgs e)
{
con = new OleDbConnection(str);
try
{
con.Open();
string sel = "Select * from login";
OleDbCommand cmd = new OleDbCommand(sel, con);
OleDbDataAdapter oda = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
oda.Fill(ds, "login");
if (this.textBox1.Text == "" || this.textBox2.Text == "")
{
MessageBox.Show("请输入帐号或密码!");
return;
}
else
{
if (this.textBox1.Text.Trim() == ds.Tables["login"].Rows[0]["zhanghao"].ToString())
{
if (this.textBox2.Text.Trim() == ds.Tables["login"].Rows[0]["mima"].ToString())
{
this.Visible = false;
qywg qy = new qywg();
qy.ShowDialog();
}
else
{
MessageBox.Show("密码不正确!");
return;
}
}
else
{
MessageBox.Show("请输入正确的帐号");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
}
}
}
}