En iyi yanıtlayıcılar
Çalıştırdığımda Excel dosyasını 1. butonla yüklüyorum .2 butonlada openfiledialogtan aldığım exceli dataviewgride aktarmada siyahla kodda gösterdiğim yazılı bölüm hata veriyor bu yüzden excel aktarılamıyor neden acaba?

Soru
-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication40
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{ this.textBox_Path.Text = openFileDialog1.FileName; }
}
private void button2_Click(object sender, EventArgs e)
{
string PathConn = "Provider=Microsoft.JET.OLEDB.12.0;Data Source=" + textBox_Path.Text + ";Extended Properties=\"Excel 12.0; HDR=YES;\";";
OleDbConnection conn = new OleDbConnection(PathConn);
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter("Select*from[" + textBox_Sheet.Text + "$]", conn);
DataTable dt = new DataTable();
myDataAdapter.Fill(dt);
dataGridView1.DataSource = dt;
}
}
}
- Düzenleyen Deniz35 19 Temmuz 2018 Perşembe 08:11
Yanıtlar
Tüm Yanıtlar
-
-
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll
Additional information: 'Microsoft.JET.OLEDB.12.0' sağlayıcısı yerel makine kayıtlı değil.hata budur myDataAdapter.Fill(dt); burdan çıkıyor yukarıda yazdığım hata