private void btnSynData_Click(object sender, EventArgs e)
        {
            string sourceDb = cboDbSource.SelectedValue.ToString();
            string targerDb = cboDbTarger.SelectedValue.ToString();

            AnalysisData ai = SqlTextHelper.Analysis(txtSqlText.Text,
                                                     cboDbSource.SelectedValue.ToString(), false, null);
            IDictionary <string, IList <string> > sqlList = ai.SqlText;

            txtResult.Text += string.Join("\r\n", sqlList["del"].ToArray()).Replace(sourceDb, targerDb);
            txtResult.Text += string.Join("\r\n", sqlList["add"].ToArray()).Replace(sourceDb, targerDb);;
            try
            {
                MessageBox.Show("" + MySqlHelper.ExecuteNonQuery(txtResult.Text));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void btnResolve_Click(object sender, EventArgs e)
        {
            List <string> list = new List <string>();

            list.Add(textBox1.Text);

            AnalysisData ai = SqlTextHelper.Analysis(txtSqlText.Text, cboDataBase.SelectedValue.ToString(), chkIsOnly.Checked, list);
            IDictionary <string, IList <string> > sqlList = ai.SqlText;

            if (chkAdd.Checked)
            {
                txtResult.Text  = string.Join("\r\n", sqlList["add"].ToArray());
                txtResult.Text += "\r\n";
            }
            if (chkDel.Checked)
            {
                txtResult.Text += string.Join("\r\n", sqlList["del"].ToArray());
                txtResult.Text += "\r\n";
            }
            if (chkUpd.Checked)
            {
                txtResult.Text += string.Join("\r\n", sqlList["upd"].ToArray());
                txtResult.Text += "\r\n";
            }

            if (chkJson.Checked)
            {
                txtResult.Text += string.Join("\r\n", sqlList["json"].ToArray());
                txtResult.Text += "\r\n";
            }

            txtLog.Text = LocalData.Logs.ToString();

            if (!string.IsNullOrEmpty(LocalData.ErrLogs.ToString()))
            {
                txtLog.Text += LocalData.ErrLogs.ToString();
                MessageBox.Show("生成有误!请查看执行日志最下面的错误信息!");
            }

            //json 字符串
        }