Пример #1
0
 private void f_Load_Tree()
 {
     try
     {
         treeView1.Nodes.Clear();
         ttDB_lbDatabase.Text = "" + m_v.s_database;
         string   aschema = "";
         TreeNode anode = null, anode1 = null;
         foreach (DataRow r in m_v.f_get_sys_schema().Tables[0].Rows)
         {
             if (aschema != r["schemaname"].ToString())
             {
                 aschema                  = r["schemaname"].ToString();
                 anode                    = new TreeNode(r["schemaname"].ToString());
                 anode.Tag                = r["schemaname"].ToString();
                 anode.ImageIndex         = 0;
                 anode.SelectedImageIndex = 1;
                 treeView1.Nodes.Add(anode);
             }
             anode1            = new TreeNode(r["tablename"].ToString());
             anode1.Tag        = r["tablename"].ToString();
             anode1.ImageIndex = 2;
             anode.Nodes.Add(anode1);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }