Ejemplo n.º 1
0
 private void menuInsert_Click(object sender, EventArgs e)
 {
     if (CreateCode != null)
     {
         string         dbName = tvDatabase.SelectedNode.Parent.Parent.Text;
         Model.Database db     = tvDatabase.SelectedNode.Parent.Parent.Tag as Model.Database;
         Model.Table    table  = tvDatabase.SelectedNode.Tag as Model.Table;
         if (table != null)
         {
             SqlSeleteViewForm ssv  = new SqlSeleteViewForm(db, table);
             string            str  = "";
             string            str2 = "insert into ";
             str2 = (str2 + "" + this.tvDatabase.SelectedNode.Text + "") + " (" + this.tvDatabase.SelectedNode.Nodes[0].Text;
             for (int i = 1; i < this.tvDatabase.SelectedNode.Nodes.Count; i++)
             {
                 str  = str + ",''";
                 str2 = str2 + "," + this.tvDatabase.SelectedNode.Nodes[i].Text;
             }
             str2 = (str2 + ") \n" + "values(''") + str + ")";
             if ((ssv.sqlTextEditor.Text.Trim().Length != 0) && (ssv.sqlTextEditor.Text[ssv.sqlTextEditor.Text.Length - 1] != '\n'))
             {
                 ssv.sqlTextEditor.Text = ssv.sqlTextEditor.Text + "\n";
             }
             ssv.sqlTextEditor.Text = ssv.sqlTextEditor.Text + str2;
             ssv.Show(MainForm.dockPanel);
         }
         else
         {
             ShowMessage.Alert("请先选中一个表或视图。");
         }
     }
 }
Ejemplo n.º 2
0
 private void menuDelete_Click(object sender, EventArgs e)
 {
     if (CreateCode != null)
     {
         string         dbName = tvDatabase.SelectedNode.Parent.Parent.Text;
         Model.Database db     = tvDatabase.SelectedNode.Parent.Parent.Tag as Model.Database;
         Model.Table    table  = tvDatabase.SelectedNode.Tag as Model.Table;
         if (table != null)
         {
             SqlSeleteViewForm ssv  = new SqlSeleteViewForm(db, table);
             string            str  = "\nwhere 1 = 1";
             string            str2 = "delete from ";
             str2 = (str2 + "" + this.tvDatabase.SelectedNode.Text + "") + str;
             if ((ssv.sqlTextEditor.Text.Trim().Length != 0) && (ssv.sqlTextEditor.Text[ssv.sqlTextEditor.Text.Length - 1] != '\n'))
             {
                 ssv.sqlTextEditor.Text = ssv.sqlTextEditor.Text + "\n";
             }
             ssv.sqlTextEditor.Text = ssv.sqlTextEditor.Text + str2;
             ssv.Show(MainForm.dockPanel);
         }
         else
         {
             ShowMessage.Alert("请先选中一个表或视图。");
         }
     }
 }