示例#1
0
        private void buttonX2_Click(object sender, EventArgs e)
        {
            bool bRTtable = true;

            for (int index = 0; index < checkedListBox1.Items.Count; ++index)
            {
                bool bCheck = checkedListBox1.GetItemChecked(index);
                if (bCheck)
                {
                    string tblname = checkedListBox1.Items[index].ToString().Trim();
                    if (tblname.Length > 7 && tblname.Substring(0, 7) != "RTTEST_")
                    {
                        bRTtable = false;
                        break;
                    }
                }
            }

            if (!bRTtable)
            {
                string message = string.Format("该功能还没使用!");
                MessageBox.Show(message);
                return;
            }

            string todbname = Program.Database;

            string[] undbname = new string[listViewEx1.Items.Count];
            bool     bExist   = false;

            for (int i = 0; i < listViewEx1.Items.Count; ++i)
            {
                undbname[i] = listViewEx1.Items[i].SubItems[0].Text;
                if (undbname[i] == todbname)
                {
                    bExist = true;
                }
            }
            if (!bExist)
            {
                MessageBox.Show("请添加本库!");
                return;
            }



            for (int index = 0; index < checkedListBox1.Items.Count; ++index)
            {
                bool bCheck = checkedListBox1.GetItemChecked(index);
                if (bCheck)
                {
                    string tblname = checkedListBox1.Items[index].ToString().Trim();
                    int[]  ret     = mDataTableProxy.UTUniteTable(tblname, todbname, undbname);
                    string message = string.Empty;
                    if (ret == null || ret[0] == -1)
                    {
                        message = "出错啦!";
                    }
                    else
                    {
                        message = string.Format("{2}共导入{0}和修改{1}行数据", ret[0], ret[1], tblname);
                    }

                    MessageBox.Show(message);
                }
            }
        }