using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyWpfProject { class VMInsertFile { public ContactBtnClickExcelCommand { get { return contactBtnClickExcelCommand; } set{ contactBtnClickExcelCommand= value; OnPropertyChanged(); } public InsertOpenDialog { DataTable dt=new DataTable(); //this error is DataTable is an ambigues reference betweenMicrosoft.Office.Interop.Excel.DataTable and System.Data.DataTable string con = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}" + @"Extended Properties='Excel 8.0;HDR=Yes;'"; using(OleDbConnection connection = new OleDbConnection(con)) { connection.Open(); OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection); using(OleDbDataReader dr = command.ExecuteReader()) { while(dr.Read()) { var row1Col0 = dr[0]; Console.WriteLine(row1Col0); } } }
System.Data.DataTable dt = new System.Data.DataTable();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)