Esempio n. 1
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            DataTable      dt     = null;
            OpenFileDialog folder = new OpenFileDialog();

            if (folder.ShowDialog() == DialogResult.OK)
            {
                String path = folder.FileName;
                dt = SystemUnit.importData(path);
            }
            else
            {
                return;
            }
            if (null == dt)
            {
                showInfo("导入数据失败", true, false);
                return;
            }

            DataTable[] dts = DBHelp.devideTable(dt);
            DGV1.DataSource = dts[0];
            DGV2.DataSource = dts[1];
            setDGV(DGV1);
            setDGV(DGV2);

            showInfo("导入数据成功", true, true);
            toolImportFile.Text      = "数据来源:" + folder.SafeFileName;
            toolImportFile.ForeColor = toolbarReadIndex.ForeColor;
        }
Esempio n. 2
0
        public void appInit()
        {
            getParamFromXML();
            setFormStatus(0);
            DataTable dt = SystemUnit.importData(Global.defaultPath);

            if (null == dt)
            {
                MessageBox.Show("初始化默认数据失败,请通过【导入表格】进行数据初始化!");
                return;
            }
            DataTable[] dts = DBHelp.devideTable(dt);
            DGV1.DataSource = dts[0];
            DGV2.DataSource = dts[1];
            setDGV(DGV1);
            setDGV(DGV2);
            toolImportFile.Text      = "数据来源:默认表格";
            toolImportFile.ForeColor = toolbarReadIndex.ForeColor;
        }