private void button1_Click(object sender, EventArgs e) { String str = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D:\\Book1.xls;" + "Extended Properties=Excel 8.0;"; DataSet d = new DataSet(); //You must use the $ after the object //you reference in the spreadsheet OleDbDataAdapter da = new OleDbDataAdapter ("SELECT * FROM [Sheet1$]", str); //da.TableMappings.Add("Table", "ExcelTest"); da.Fill(d); dataGrid1.DataSource = d.Tables[0].DefaultView; dataGrid1.DataBind(); }
error in line >>>> dataGrid1.DataBind();
Error 1 'System.Windows.Forms.DataGridView' does not contain a definition for 'DataBind' and no extension method 'DataBind' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be found (are you missing a using directive or an assembly reference?) D:\Ex\C#\Test GUI\1\ex\WindowsFormsApplication3\WindowsFormsApplication3\Form1.cs 38 23 WindowsFormsApplication3
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)