private void buttonX3_Click(object sender, EventArgs e) { string deletecommand = "delete * from SpareTime_Data"; string selectcommand = "select * from SpareTime_Data"; DataTable dt = help.getDs(selectcommand, "SpareTime_Data").Tables[0]; if (dt.Rows.Count != 0) { if (help.Oledbcommand(deletecommand) > 0) { try { Placement selecttime = new Placement(); selecttime.AutoSelectSpareTime(progressBar1); if (progressBar1.Value == progressBar1.Maximum) { MessageBox.Show("自动填补成功"); progressBar1.Value = 0; listView1.Items.Clear(); ListSupervisor.Clear(); week.Clear(); strweek.Clear(); frmSpareTime_Load(sender, e); } else { } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else { MessageBox.Show("请手动删除当前数据表数据"); } } else { try { Placement selecttime = new Placement(); selecttime.AutoSelectSpareTime(progressBar1); if (progressBar1.Value == progressBar1.Maximum) { MessageBox.Show("自动填补成功"); progressBar1.Value = 0; listView1.Items.Clear(); ListSupervisor.Clear(); week.Clear(); strweek.Clear(); frmSpareTime_Load(sender, e); } else { } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }