/// <summary> /// import from sheet Pojistovna /// </summary> /// <param name="excel_con"></param> private void ImportTypSmlouvy(OleDbConnection excel_con) { DataTable dtExcelData = new DataTable(); dtExcelData.Columns.AddRange(new DataColumn[5] { new DataColumn("Id", typeof(int)), new DataColumn("Kod", typeof(string)), new DataColumn("Nazev", typeof(string)), new DataColumn("DatumOd", typeof(DateTime)), new DataColumn("DatumDo", typeof(DateTime)) }); using (OleDbDataAdapter oda = new OleDbDataAdapter("SELECT * FROM [TypSmlouvy$]", excel_con)) { oda.Fill(dtExcelData); foreach (DataRow row in dtExcelData.Rows) { _dataConnector.CreateTypSmlouvy((string)row["Kod"], (string)row["Nazev"], (DateTime)row["DatumOd"], row.IsNull("DatumDo") ? null : (DateTime?)row["DatumDo"]); } } }