using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication1
{
public partial class 主界面 : Form
{
OleDbDataAdapter adapter;
DataTable table = new DataTable();
string str = @"Provider=Microsoft.Jet.OLEDB.12.0;
DataSource=D:\4S店销售\DB.accdb";
OleDbConnection connection = new OleDbConnection();
public 主界面()
{
InitializeComponent();
}
private void 主界面_Load(object sender, EventArgs e)
{
textBox1.Text = textBox2.Text = string.Empty;
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text != "" && textBox2.Text != "")
{
string sql = "select * from user where ID ='" + textBox1.Text + "' and 密码 = '" + textBox2.Text + "'";
adapter = new OleDbDataAdapter(sql, str);
OleDbCommandBuilder buider = new OleDbCommandBuilder(adapter);
adapter.InsertCommand = buider.GetInsertCommand();
table.Clear();
adapter.Fill(table);
if (table.Rows.Count > 0)
{
Form 新建客户信息 = new 新建客户信息();
新建客户信息.Show();
this.Hide();
}
}
else
{
MessageBox.Show("用户名或密码不能为空");
}
if (radioButton1.Checked == true)
{
this.Hide();
new 新建客户信息().ShowDialog();
}
else if (radioButton2.Checked == true)
{
this.Hide();
new 员工信息().ShowDialog();
}
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
}
}
}