Beispiel #1
0
        private static DataTable TestReadExcelSheet(string filename)
        {
            // string filename = "500010";
            string fullFilePath = string.Format(@"..\..\Data\Downloads\{0}.csv", filename);

            ReadExcelSheetInput input = new ReadExcelSheetInput();

            input.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Mode=ReadWrite;Extended Properties=""text;HDR=Yes;FMT=Delimited"";";
            input.SelectCommand    = @"SELECT * FROM [{0}.csv]";

            input.ConnectionString = string.Format(input.ConnectionString, fullFilePath.Substring(0, fullFilePath.LastIndexOf('\\')));
            input.SelectCommand    = string.Format(input.SelectCommand, filename);

            // Console.WriteLine("+++ Connection String:");
            // Console.WriteLine(input.ConnectionString);

            // Console.WriteLine("+++ Select Command:");
            // Console.WriteLine(input.SelectCommand);

            // Console.WriteLine("***************************************************");
            // Console.WriteLine("BSE: {0}", filename);
            // Console.WriteLine("***************************************************");

            var output = new ReadExcelSheetOutput();

            output = new ReadExcelSheet().Execute(input);

            return(output.ExcelSheetTable);
        }
Beispiel #2
0
        public ReadExcelSheetOutput Execute(ReadExcelSheetInput input)
        {
            // Assign and Validate Input
            _input = input;
            _input.ValidateInput();

            // Initialize Output
            _output = new ReadExcelSheetOutput();

            // Read the contents of the Excel Sheet as a Data Table
            _output.ExcelSheetTable = _ReadExcelSheetAsTable(_input.ConnectionString, _input.SelectCommand);

            return _output;
        }
Beispiel #3
0
        public ReadExcelSheetOutput Execute(ReadExcelSheetInput input)
        {
            // Assign and Validate Input
            _input = input;
            _input.ValidateInput();

            // Initialize Output
            _output = new ReadExcelSheetOutput();

            // Read the contents of the Excel Sheet as a Data Table
            _output.ExcelSheetTable = _ReadExcelSheetAsTable(_input.ConnectionString, _input.SelectCommand);

            return(_output);
        }
Beispiel #4
0
        private static DataTable TestReadExcelSheet(string filename)
        {
            // string filename = "500010";
            string fullFilePath = string.Format(@"..\..\Data\Downloads\{0}.csv", filename);

            ReadExcelSheetInput input = new ReadExcelSheetInput();
            input.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Mode=ReadWrite;Extended Properties=""text;HDR=Yes;FMT=Delimited"";";
            input.SelectCommand = @"SELECT * FROM [{0}.csv]";

            input.ConnectionString = string.Format(input.ConnectionString, fullFilePath.Substring(0, fullFilePath.LastIndexOf('\\')));
            input.SelectCommand = string.Format(input.SelectCommand, filename);

            // Console.WriteLine("+++ Connection String:");
            // Console.WriteLine(input.ConnectionString);

            // Console.WriteLine("+++ Select Command:");
            // Console.WriteLine(input.SelectCommand);

            // Console.WriteLine("***************************************************");
            // Console.WriteLine("BSE: {0}", filename);
            // Console.WriteLine("***************************************************");

            var output = new ReadExcelSheetOutput();
            output = new ReadExcelSheet().Execute(input);

            return output.ExcelSheetTable;
        }