Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String filepath = MyTools.GetOpenExcelFilePath();

            if (filepath == null)
            {
                return;
            }

            try
            {
                //读取表格并导入到数组中
                MyTools.ReadExcel(filepath);
            }
            catch (Exception exception)
            {
                textBox1.Text += "\r\n读取出错:" + exception.Message;
                // textBox1.Text +=
            }



            if (Form1.PersonList != null)
            {
                //清空人员数据库
                MySqlitePersons.DeletePersonsTable();
                //写入人员到数据库
                MySqlitePersons.WritePersonsToSQL();

                //显示到数据ListView
                AddDataToListView();
            }
            textBox1.Text += "\r\n读取成功";
        }
Ejemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            //清除所有人员功能,清空人员数据
            listView1.Items.Clear();
            Form1.PersonList = new List <List <String> >();

            //删除数据库表
            MySqlitePersons.DeletePersonsTable();
        }