using ExcelDataReader; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; namespace UtilizzoExcelByPath { [TestClass] public class UnitTest1 { static Dataset mTestData; [ClassInitialize] public static void BeforeAllTests(TestContext testContext) { using (var stream = File.Open(@"C:\Users\Lenovo\Desktop\Baa.xlsx", FileMode.Open, FileAccess.Read)) { // Auto-detect format, supports: // - Binary Excel files (2.0-2003 format; *.xls) // - OpenXml Excel files (2007 format; *.xlsx, *.xlsb) using (var reader = ExcelReaderFactory.CreateReader(stream)) { mTestData = reader.AsDataSet(); } } }
Dataset
UtilizzoExcelByPath
static DataSet mTestData; // capital S for Set // or better still, use the full name static System.Data.DataSet mTestData;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)