VS2010运行会出现这个bug

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)
    {

    }
}

}
图片说明

2个回答

Microsoft.Jet.OLEDB.12.0;
哪里有这个Provider,你瞎编的吧。

需要用ACE12.0,去微软网站下载。

你用到其他什么控件了吗?要么重新安装VS

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐