Example #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="strServer">服务器名称</param>
 /// <param name="strDbName">数据库名称</param>
 /// <param name="strTableName">数据库表名</param>
 /// <param name="dbType">类型</param>
 public FrmTableView(ServerTag serverTag, string strDbName, string strTableName)
 {
     InitializeComponent();
     m_strTableName    = strTableName;
     m_strServer       = serverTag.Server;
     m_strDbName       = strDbName;
     m_dbType          = serverTag.DBType;
     grdTable.EditMode = DataGridViewEditMode.EditOnEnter;
     this.Text         = "打开表" + "_" + m_strServer + "_" + m_strDbName + "_" + m_strTableName;
     m_databaseSchema  = GlobalHelp.GetDatabaseSchema(serverTag.DBType, serverTag.Server, strDbName);
     m_dbHelper        = DataBaseManager.GetDbHelper(m_dbType, m_databaseSchema.ConnectionString);
     m_lstCopyRow      = new List <DataRow>();
     BindGrid(m_strTableName);
 }
Example #2
0
 /// <summary>
 /// 构造函数 构造函数
 /// </summary>
 /// <param name="strServer">服务器名称</param>
 /// <param name="strDbName">数据库名称</param>
 /// <param name="strTableName">数据库表名</param>
 /// <param name="dbType">类型</param>
 /// <param name="blnNew">是否新增表,true 新增表,false,设计表</param>
 public FrmTableNew(ServerTag serverTag, string strDbName, string strTableName, SqlType dbType, bool blnNew)
 {
     InitializeComponent();
     m_dal                        = new Bse_DataDictionaryDAL();
     m_strTableName               = strTableName;
     m_strServer                  = serverTag.Server;
     m_strDbName                  = strDbName;
     m_dbType                     = dbType;
     grdTable.EditMode            = DataGridViewEditMode.EditOnEnter;
     grdTable.AutoGenerateColumns = false;
     m_databaseSchema             = GlobalHelp.GetDatabaseSchema(serverTag.DBType, serverTag.Server, strDbName);
     m_dbHelper                   = DataBaseManager.GetDbHelper(m_dbType, m_databaseSchema.ConnectionString);
     m_sqlTasks                   = new SqlTasks(m_dbType);
     m_blnNew                     = blnNew;
 }
Example #3
0
        /// <summary>执行
        /// 执行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdRun_Click(object sender, EventArgs e)
        {
            if (cboDbName.Text.Trim().Length == 0)
            {
                MessageBox.Show(@"请选择要执行的数据库");
                return;
            }
            if (txtSql.Text.Trim().Length == 0)
            {
                MessageBox.Show(@"请输入要执行的脚本语句");
                txtSql.Select();
                return;
            }

            foreach (TabPage item in tabResult.TabPages)
            {
                if (item.Name != "tabPage1")
                {
                    tabResult.TabPages.Remove(item);
                }
            }
            cmdRun.Enabled = false;
            DatabaseSchema dbSchema = GlobalHelp.GetDatabaseSchema(m_serverTag.DBType, m_serverTag.Server, cboDbName.Text.Trim());

            switch (m_serverTag.DBType)
            {
            case SqlType.SqlServer:
            case SqlType.MySql:
            case SqlType.SQLite:
                toolStripProgressBar1.Visible = true;
                object[] objArgument = new object[] { dbSchema, txtSql.Text };
                bckWorker.RunWorkerAsync(objArgument);
                break;

            case SqlType.Oracle:
                break;

            case SqlType.SqlServerCe:
                break;

            case SqlType.PostgreSql:
                break;

            case SqlType.Db2:
                break;
            }
        }