コード例 #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);
        }
コード例 #2
0
ファイル: ReadExcelSheet.cs プロジェクト: omprsingh/CashCow
        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;
        }
コード例 #3
0
ファイル: ReadExcelSheet.cs プロジェクト: tastypotinc/CashCow
        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);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: omprsingh/CashCow
        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;
        }