예제 #1
0
        private void FillDS()
        {
            if (ds != null && ds.Tables.Count > 0)
            {
                _dataGrid.DataSource = ds.Tables[0];
                List <string> l = new List <string>();

                foreach (DataGridViewColumn col in _dataGrid.Columns)
                {
                    l.Add(col.HeaderText);
                }

                int i = 0;
                foreach (string col in l)
                {
                    try
                    {
                        System.Data.DataSet dss = myDb.RetriveDataSet("select tname,caption,reftable,refcol from t_dict_column where cname='" + col + "'");
                        string reft             = dss.Tables[0].Rows[0]["reftable"].ToString();
                        if (reft != "" && (reft.StartsWith("K") || reft.StartsWith("Z") || reft.StartsWith("G")))
                        {
                            AddComboBoxColumns(dss.Tables[0].Rows[0]["reftable"].ToString(), col, i);
                        }
                    }
                    catch (Exception)
                    {
                    }
                    i++;
                }

                foreach (DataGridViewColumn col in _dataGrid.Columns)
                {
                    try
                    {
                        col.HeaderText = myDb.ExecuteScalar("select Caption from t_dict_column where cname='" + col.HeaderText + "'").ToString();  // 中文字段名
                    }
                    catch (Exception)
                    {
                    }
                }

                _dataGrid.AutoResizeColumns();
                _dataGrid.Columns[0].Frozen = true;

                if (_dataGrid.Rows.Count > 0 && _listResult.FindItemWithText(cbCheck.Text) == null)   //加入记录list
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = cbCheck.Text;
                    item.SubItems.Add(sql);
                    item.SubItems.Add(_dataGrid.Rows.Count.ToString());
                    item.SubItems.Add(cbType.Text);
                    _listResult.Items.Add(item);
                }
            }

            pb.Visible   = false;
            _msgBox.Text = msgFile.ReadString(cbType.Text, cbCheck.Text, "");
        }
예제 #2
0
        private void cbCheck_SelectedIndexChanged(object sender, EventArgs e)
        {
            sql = chkFile.ReadString(cbType.Text, cbCheck.Text, "");
            if (cbYear.Text != "")
            {
                sql = sql.Replace("$", cbYear.Text);
            }

            if (sql.IndexOf("UPDATE") >= 0 || sql.IndexOf("DELETE") >= 0)
            {
                if (MessageBox.Show("当前检查对原始数据有修改,是否执行?\r\n" + cbCheck.Text, "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    OnCheck();
                }
                else
                {
                    return;
                }
            }

            OnCheck();
        }
예제 #3
0
 private void cbCheck_SelectedIndexChanged(object sender, EventArgs e)
 {
     sql = chkFile.ReadString(cbType.Text, cbCheck.Text, "");
     OnCheck();
 }