260513_01_ENH: 엑셀 통합문서가 아닌 xlsx가 들어오는 경우 오류처리 적용
This commit is contained in:
@@ -45,6 +45,13 @@ namespace Keps.WinForms.Infrastructure
|
|||||||
throw new InvalidOperationException("먼저 Open을 호출해야 합니다.");
|
throw new InvalidOperationException("먼저 Open을 호출해야 합니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_package.Workbook.Worksheets == null || _package.Workbook.Worksheets.Count == 0)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
"엑셀 시트를 읽을 수 없습니다. 파일이 Strict Open XML 형식이면 일반 Excel 통합 문서(.xlsx)로 다시 저장한 뒤 시도하세요."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (ExcelWorksheet worksheet in _package.Workbook.Worksheets)
|
foreach (ExcelWorksheet worksheet in _package.Workbook.Worksheets)
|
||||||
{
|
{
|
||||||
if (worksheet == null)
|
if (worksheet == null)
|
||||||
|
|||||||
@@ -310,8 +310,6 @@ namespace Keps.WinForms.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
using (SqlConnection connection = _connectionFactory.Open())
|
using (SqlConnection connection = _connectionFactory.Open())
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
using (SqlCommand deleteCommand = new SqlCommand("DELETE FROM cand_name WHERE ele_ym = @eleYm", connection))
|
using (SqlCommand deleteCommand = new SqlCommand("DELETE FROM cand_name WHERE ele_ym = @eleYm", connection))
|
||||||
{
|
{
|
||||||
@@ -330,10 +328,6 @@ namespace Keps.WinForms.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user