Click here to Skip to main content
15,607,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sorry for annoying you with something that, for a lot of you, may be easy.

using ExcelDataReader;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;

namespace UtilizzoExcelByPath
    public class UnitTest1
        static Dataset mTestData;


        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();

What I have tried:

I take back the error CS00029, how can I fix this error?
Updated 7-Feb-22 5:58am
Nima Nikravan 7-Feb-22 9:37am    
Sorry, wrong error number.
the right error number is CS0029
Dave Kreskowiak 7-Feb-22 9:40am    
What's the exact error message? Nobody gives a sh*t about the error numbers.
Nima Nikravan 7-Feb-22 9:44am    
Cannot implicitly convert type 'System.Data.DataSet" in "UtilizzoExcelByPath.Dataset"
Richard MacCutchan 7-Feb-22 9:51am    
Which line causes the error?
Nima Nikravan 7-Feb-22 9:53am    
line 23 mTestData = reader.AsDataSet();

1 solution

Your declaration of Dataset is incorrect because it is mis-spelled; the compiler thinks it is part of the namespace UtilizzoExcelByPath. It should be:
        static DataSet mTestData; // capital S for Set
// or better still, use the full name
        static System.Data.DataSet mTestData;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900