Exemple #1
0
        //数据库脚本
        private void CreatDBScript()
        {
            this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
            LTP.IDBO.IDbScriptBuilder dsb = ObjHelper.CreatDsb(servername);
            dsb.Fieldlist = GetFieldlist();
            string strScript = dsb.CreateTabScript(dbname, tablename);

            SettxtContent("SQL", strScript);
            this.Cursor = System.Windows.Forms.Cursors.Default;
        }
Exemple #2
0
        void ThreadWork()
        {
            try
            {
                this.Text               = "正在生成脚本...";
                this.Cursor             = System.Windows.Forms.Cursors.WaitCursor;
                this.btn_Creat.Enabled  = false;
                this.btn_Cancle.Enabled = false;
                string dbname   = this.cmbDB.Text;
                string strtitle = "数据库名:" + dbname;
                int    tblCount = this.listTable2.Items.Count;

                string filename = this.txtTargetFolder.Text;
                this.progressBar1.Maximum = tblCount;
                this.labelNum.Text        = "0";

                #region 循环每个表

                for (int i = 0; i < tblCount; i++)
                {
                    this.listTable2.SelectedIndex = i;
                    string tablename = this.listTable2.Items[i].ToString();
                    dsb.CreateTabScript(dbname, tablename, filename, progressBar2);

                    this.progressBar1.Value = i + 1;
                    this.labelNum.Text      = (i + 1).ToString();
                }
                #endregion

                this.btn_Creat.Enabled  = true;
                this.btn_Cancle.Enabled = true;
                this.Text   = "脚本全部生成成功!";
                this.Cursor = System.Windows.Forms.Cursors.Default;
                MessageBox.Show("脚本全部生成成功!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (System.Exception ex)
            {
                LogInfo.WriteLog(ex);
                this.btn_Creat.Enabled  = true;
                this.btn_Cancle.Enabled = true;
                this.Text   = "脚本生成失败!";
                this.Cursor = System.Windows.Forms.Cursors.Default;
                MessageBox.Show("脚本生成失败!请检查表名是否规范或其他问题导致。(" + ex.Message + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #3
0
        void ThreadWork()
        {
            try
            {
                //this.Cursor=System.Windows.Forms.Cursors.WaitCursor;
                SetBtnDisable();
                int    tblCount = this.listTable2.Items.Count;
                string filename = this.txtTargetFolder.Text;

                SetprogressBar1Max(tblCount);
                SetprogressBar1Val(1);
                SetlblStatuText("0");

                #region 循环每个表

                for (int i = 0; i < tblCount; i++)
                {
                    //this.listTable2.SelectedIndex=i;
                    string tablename = this.listTable2.Items[i].ToString();
                    dsb.Fieldlist = new List <LTP.CodeHelper.ColumnInfo>();
                    dsb.CreateTabScript(DbName, tablename, filename, progressBar2);

                    SetprogressBar1Val(i + 1);
                    SetlblStatuText((i + 1).ToString());
                }
                #endregion

                SetBtnEnable();
                //this.Cursor=System.Windows.Forms.Cursors.Default;
                MessageBox.Show("脚本全部生成成功!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (System.Exception ex)
            {
                LogInfo.WriteLog(ex);
                SetBtnEnable();
                //this.Cursor=System.Windows.Forms.Cursors.Default;
                MessageBox.Show("脚本生成失败!请检查表名是否规范或其他问题导致。(" + ex.Message + ")", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }