/// <summary> /// Consulta a tabela temporaria gerada pela importação da planilha em Excel /// Não esquecer de se for outro nome da sheet, trocar o nome da tabela temporária /// </summary> /// <returns></returns> public static List <string> ConsultaDadosDetalhe() { using (SqlConnection cnx = new SqlConnection(upSight.Consulta.Base.BD.Conexao.StringConexaoBDGlobal)) { List <string> lst = null; try { string query = "SELECT * FROM [crtACSImpSimp$]"; using (SqlCommand cmd = new SqlCommand(query, cnx)) { cmd.CommandType = CommandType.Text; cnx.Open(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleResult); lst = new List <string>(); while (dr.Read()) { lst.Add(IdentificacaoProcessamento.CompoeLinhaDetalhe(dr)); } } } catch (SqlException sql) { throw sql; } catch (Exception e) { throw e; } return(lst); } }
public void ImportaPlanilha() { var log = new upSight.Global.Log.CN.Logging(); log.IdEntidade = 1; log.IdUsuario = 1; IdentificacaoProcessamento imp = new IdentificacaoProcessamento(); imp.Log = log; string arquivo = "TesteImpSimpf.xlsx"; string nomeArquivoCompleto = Path.Combine(ConfigurationManager.AppSettings["DiretotioOrigemACSOIDTS"], arquivo); imp.LePlanilhaExcelEInsereDados(nomeArquivoCompleto); }