private void BindTablist(string Dbname) { List <TableInfo> tablist = dbobj.GetTablesInfo(Dbname); if ((tablist != null) && (tablist.Count > 0)) { foreach (TableInfo tab in tablist) { string name = tab.TabName; cmbox_PTab.Items.Add(name); cmbox_STab.Items.Add(name); } } //cmbox_PTab.DataSource = dt; //cmbox_PTab.DisplayMember = "name"; //cmbox_PTab.ValueMember = "name"; //cmbox_STab.DataSource = dt.DefaultView; //cmbox_STab.DisplayMember = "name"; //cmbox_STab.ValueMember = "name"; }
private void BindlistViewTab(string Dbname, string SelNodeType) { // SetListViewMenu("table"); this.listView1.Columns.Clear(); this.listView1.Items.Clear(); this.listView1.LargeImageList = imglistView; this.listView1.SmallImageList = imglistView; this.listView1.View = View.Details; this.listView1.FullRowSelect = true; listView1.Columns.Add("名称", 250, HorizontalAlignment.Left); listView1.Columns.Add("所有者", 100, HorizontalAlignment.Left); listView1.Columns.Add("类型", 60, HorizontalAlignment.Left); listView1.Columns.Add("创建日期", 200, HorizontalAlignment.Left); List <TableInfo> tablist = null; switch (SelNodeType) { case "db": tablist = dbobj.GetTabViewsInfo(Dbname); break; case "tableroot": tablist = dbobj.GetTablesInfo(Dbname); break; case "viewroot": tablist = dbobj.GetVIEWsInfo(Dbname); break; case "procroot": tablist = dbobj.GetProcInfo(Dbname); break; } if ((tablist != null) && (tablist.Count > 0)) { foreach (TableInfo tab in tablist) { string name = tab.TabName; ListViewItem item1 = new ListViewItem(name, 0); string user = tab.TabUser; item1.SubItems.Add(user); string type = tab.TabType; switch (type.Trim()) { case "S": type = "系统"; break; case "U": type = "用户"; item1.ImageIndex = 2; break; case "TABLE": type = "表"; item1.ImageIndex = 2; break; case "V": case "VIEW": type = "视图"; item1.ImageIndex = 3; break; case "P": type = "存储过程"; item1.ImageIndex = 5; break; default: type = "系统"; break; } item1.SubItems.Add(type); string time = tab.TabDate; item1.SubItems.Add(time); listView1.Items.AddRange(new ListViewItem[] { item1 }); } } //if (dt != null) //{ // DataRow[] dRows = dt.Select("", "type,name ASC"); // foreach (DataRow row in dRows) // { // string name = row["name"].ToString(); // ListViewItem item1 = new ListViewItem(name, 0); // string user = row["cuser"].ToString(); // item1.SubItems.Add(user); // string type = row["type"].ToString(); // switch (type.Trim()) // { // case "S": // type = "系统"; // break; // case "U": // type = "用户"; // item1.ImageIndex = 2; // break; // case "TABLE": // type = "表"; // item1.ImageIndex = 2; // break; // case "V": // case "VIEW": // type = "视图"; // item1.ImageIndex = 3; // break; // case "P": // type = "存储过程"; // item1.ImageIndex = 5; // break; // default: // type = "系统"; // break; // } // item1.SubItems.Add(type); // string time = row["dates"].ToString(); // item1.SubItems.Add(time); // listView1.Items.AddRange(new ListViewItem[] { item1 }); // } //} }