Esempio n. 1
0
 //gombhoz esemény rendelése
 void testButton_Click(object sender, RibbonControlEventArgs e)
 {
     ExcelToSql.ExcelToSqlService _excelToSql = new ExcelToSql.ExcelToSqlService();
     _excelToSql.ExcelApplictaion = this.ExcelApplication;
     _excelToSql.InitConnectionParameters(SERVER, DATABASE, SQLUSER, SQLPW);
     SqlProcessParameters sqlparam = new SqlProcessParameters();
     sqlparam.SqlStatement.SqlScript = "Select * from dbo.tbl_TeamFile";
     sqlparam.SqlStatement.WorksheetName = "TestSheet";
     sqlparam.SqlStatement.RangeName = testRange.RangeName;
     _excelToSql.GetCommand(sqlparam);
 }
        void exportButton_Click(object sender, RibbonControlEventArgs e)
        {
            ExcelToSql.ExcelToSqlService _excelToSql = new ExcelToSql.ExcelToSqlService();
            _excelToSql.ExcelApplictaion = this.ExcelApplication;
            _excelToSql.InitConnectionParameters(SERVER, DATABASE, SQLUSER, SQLPW);
            SqlProcessParameters sqlparam = new SqlProcessParameters();

            sqlparam.SqlStatement.SqlScript = "EXEC sp.CSVCreator 'gen','tbl_LOGA_MorganStanley_vacation',1,32,';'";
            sqlparam.SqlStatement.WorksheetName = "ExportSheet";
            sqlparam.SqlStatement.RangeName = exportRange.RangeName;
            _excelToSql.ExecuteCommand(sqlparam);

            sqlparam.SqlStatement.SqlScript = "SELECT * from gen.tbl_LOGA_MorganStanley_vacationCSV";
            _excelToSql.GetCommand(sqlparam);
            ActiveWorkbook.SaveAs(@"c:\Users\csegenyr\Desktop\csvresult.csv", InteropExcel.XlFileFormat.xlCSV);
        }