/// <summary> /// /// </summary> private void getDatabaseinfo() { TreeNode node = tview.SelectedNode; Connection conModel = list.Find(delegate(Connection con) { return(con.ID.ToString().Equals(node.Tag.ToString())); }); IDbObject dbObject; if (conModel.DbType.Equals(Dos.ORM.DatabaseType.MsAccess.ToString())) { dbObject = new Dos.Tools.DbDAL.OleDb.DbObject(conModel.ConnectionString); TreeNode tnode = new TreeNode(conModel.Database, 1, 1); tnode.Tag = conModel.ConnectionString; tnode.ContextMenuStrip = contextMenuStripOneDataBase; node.Nodes.Add(tnode); gettables(tnode, dbObject.GetTables(""), dbObject.GetVIEWs("")); } else if (conModel.DbType.Equals(Dos.ORM.DatabaseType.Sqlite3.ToString())) { dbObject = new DbObject(conModel.ConnectionString); TreeNode tnode = new TreeNode(conModel.Database, 1, 1); tnode.Tag = conModel.ConnectionString; tnode.ContextMenuStrip = contextMenuStripOneDataBase; node.Nodes.Add(tnode); gettables(tnode, dbObject.GetTables(""), dbObject.GetVIEWs("")); } else if (conModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer.ToString()) || conModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer9.ToString())) { if (conModel.DbType.Equals(Dos.ORM.DatabaseType.SqlServer.ToString())) { dbObject = new Dos.Tools.DbDAL.SQL2000.DbObject(conModel.ConnectionString); } else { dbObject = new Dos.Tools.DbDAL.SQL2005.DbObject(conModel.ConnectionString); } if (conModel.Database.Equals("all")) { DataTable dt = dbObject.GetDBList(); foreach (DataRow dr in dt.Rows) { TreeNode tnode = new TreeNode(dr[0].ToString(), 1, 1); tnode.Tag = conModel.ConnectionString.Replace("master", dr[0].ToString()); tnode.ContextMenuStrip = contextMenuStripOneDataBase; node.Nodes.Add(tnode); gettables(tnode, dbObject.GetTables(tnode.Text), dbObject.GetVIEWs(tnode.Text)); } } else { TreeNode tnode = new TreeNode(conModel.Database, 1, 1); tnode.Tag = conModel.ConnectionString; tnode.ContextMenuStrip = contextMenuStripOneDataBase; node.Nodes.Add(tnode); gettables(tnode, dbObject.GetTables(tnode.Text), dbObject.GetVIEWs(tnode.Text)); } } else if (conModel.DbType.Equals(Dos.ORM.DatabaseType.Oracle.ToString())) { dbObject = new Dos.Tools.DbDAL.Oracle.DbObject(conModel.ConnectionString); TreeNode tnode = new TreeNode(conModel.Database, 1, 1); tnode.Tag = conModel.ConnectionString; tnode.ContextMenuStrip = contextMenuStripOneDataBase; node.Nodes.Add(tnode); gettables(tnode, dbObject.GetTables(tnode.Text), dbObject.GetVIEWs(tnode.Text)); } else if (conModel.DbType.Equals(Dos.ORM.DatabaseType.MySql.ToString())) { dbObject = new Dos.Tools.DbDAL.MySql.DbObject(conModel.ConnectionString); if (conModel.Database.Equals("all")) { DataTable dt = dbObject.GetDBList(); foreach (DataRow dr in dt.Rows) { TreeNode tnode = new TreeNode(dr[0].ToString(), 1, 1); tnode.Tag = conModel.ConnectionString.Replace("master", dr[0].ToString()); tnode.ContextMenuStrip = contextMenuStripOneDataBase; node.Nodes.Add(tnode); gettables(tnode, dbObject.GetTables(tnode.Text), dbObject.GetVIEWs(tnode.Text)); } } else { TreeNode tnode = new TreeNode(conModel.Database, 1, 1); tnode.Tag = conModel.ConnectionString; tnode.ContextMenuStrip = contextMenuStripOneDataBase; node.Nodes.Add(tnode); gettables(tnode, dbObject.GetTables(tnode.Text), dbObject.GetVIEWs(tnode.Text)); } } }