Esempio n. 1
0
 protected void btnNewTable_Click(object sender, EventArgs e)
 {
     if ((!rdbNewProc.Checked && !rdbCustom.Checked) && txtNewTable_Name.Text.Trim().Length == 0)
     {
         labNewTableTip.Text = "请输入表名";
         Timer1.Enabled      = true;
         return;
     }
     if (txtColumnList.Text.Trim().Length < 1)
     {
         labNewTableTip.Text = "请输入定义或SQL脚本";
         Timer1.Enabled      = true;
         return;
     }
     getSconn();
     _bll = new ToolBll(Session["sConn"].ToString());
     labNewTableTip.Text = "正在执行";
     if (rdbNewTable.Checked)
     {
         if (_bll.createTable(txtNewTable_Name.Text.Trim(), txtColumnList.Text.Trim()))
         {
             labNewTableTip.Text = "新增成功";
             BindDataList(hidTabType.Value);
             panToolBar.Visible    = true;
             panMessage.Visible    = false;
             lnkDelete.Visible     = false;
             txtNewTable_Name.Text = txtColumnList.Text = string.Empty;
         }
         else
         {
             labNewTableTip.Text = "新增失败,请检查输入是否有误";
         }
     }
     else if (rdbNewView.Checked)
     {
         if (_bll.createView(txtNewTable_Name.Text.Trim(), txtColumnList.Text.Trim()))
         {
             labNewTableTip.Text = "新增成功";
             BindDataList(hidTabType.Value);
             panToolBar.Visible    = true;
             panMessage.Visible    = false;
             lnkDelete.Visible     = false;
             txtNewTable_Name.Text = txtColumnList.Text = string.Empty;
         }
         else
         {
             labNewTableTip.Text = "新增失败,请检查输入是否有误";
         }
     }
     else if (rdbNewProc.Checked || rdbCustom.Checked)
     {
         if (!txtColumnList.Text.StartsWith("create", true, CultureInfo.CurrentCulture))
         {
             labNewTableTip.Text = "只能执行create语句";
         }
         else if (_bll.createProcedure(txtColumnList.Text))
         {
             labNewTableTip.Text = "新增成功";
             BindDataList(hidTabType.Value);
             panToolBar.Visible    = true;
             panMessage.Visible    = false;
             lnkDelete.Visible     = false;
             txtNewTable_Name.Text = txtColumnList.Text = string.Empty;
         }
         else
         {
             labNewTableTip.Text = "执行失败,请检查输入是否有误";
         }
     }
     Timer1.Enabled = true;
 }