The facility has not been found by the microsoft office access core. C# Forms
-
We need to import excel data from the file into the datagridview, but he can't find the file, although the path was right. Makes a mistake: the facility is not found by the microsoft office access core. Where's the mistake? Thank you. Excel himself https://imgur.com/W0ENhDF
using System.Data; using System.Threading.Tasks; using System.Windows.Forms; using Excel = Microsoft.Office.Interop.Excel; using System.IO; using System.Reflection; using System.Data.OleDb; namespace WindowsFormsApplication5 { public partial class Form1 : Form { DataSet ds = new DataSet(); OleDbDataAdapter adapter = new OleDbDataAdapter();
public Form1() { InitializeComponent(); } private void Connection_Click(object sender, EventArgs e) { string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); MessageBox.Show(path.ToString()); path = Path.Combine(path, "textfortest.xlsx"); string ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+path+@"; Extended Properties=""Excel 12.0 Macro;HDR=Yes;ImportMixedTypes=Text;TypeGuessRowsIMEX=1;TypeGuessRows=0"""; OleDbConnection conn = new OleDbConnection(ConnectionString); string Strcmd = "select * from [Лист1$A1:D9]"; OleDbCommand cmd = new OleDbCommand(Strcmd, conn); try { conn.Open(); ds.Clear(); adapter.SelectCommand = cmd; adapter.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { conn.Close(); } } }
}
-
Erroneous report on an unification request containing more than one association for complex data tables: "The target is not found by the Microsoft Office Access nucleus."
The following erroneous report may be displayed in adding the investment field to the table: { The object has not been found the core of the Microsoft Office Access database. Check the existence of the object and the correct name and path. ♪ This error occurs when a request for integration is in the field with more than one association for complex data tables.
Acceptance https://support.microsoft.com/ru-ru/kb/942378
p.s. I think the problem with the names of the columns seems like