private void inputOSToolStripMenuItem_Click(object sender, EventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { DataTable excelTable = new DataTable(); openFileDialog1.Multiselect = false; string filePath = openFileDialog1.FileName; string fileType = System.IO.Path.GetExtension(filePath); string SheetName1 = "手术医生编号"; if (string.IsNullOrEmpty(fileType)) { return; } excelTable = UserFunction.GetDataFromExcel(fileType, filePath, SheetName1); excelTable = UserFunction.removeEmptyRow(excelTable); string OsNo = ""; string OsName = ""; string NameSuoxie = ""; foreach (DataRow drE in excelTable.Rows) { string OS = drE[0].ToString(); string[] OSlist = OS.Split('_'); OsNo = OSlist[0]; OsName = OSlist[1]; NameSuoxie = OSlist[2]; dal.InsertShoushuYisheng(OsNo, OsName, NameSuoxie); } MessageBox.Show("导入完成"); } }