嗨,我是 C# 新手,正在尝试连接到 .accdb 访问 2010 数据库
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection connect = new OleDbConnection();
connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Web Develop\Documents\Storekeeper\storekeeper.accdb;Persist Security Info=False;";
connect.Open();
MessageBox.Show("Connection open");
}
}
}
我得到了这个例外:
System.Data.OleDb.OleDbException
System.Data.dll 中发生了第一次机会异常类型
数据库未使用且路径正确,我该怎么办?