public ActionResult GetAllTables(string sDBname) { var ret = new QueryResult(); ret.retCode = false; SqlConnUtil connInfo = Session[KEY_LOGINFO] as SqlConnUtil; if (connInfo == null) { return(Json(ret)); } //取数据库的所有用户表 using ( var dbConn = new NativeDBHelper(connInfo.DBHost, connInfo.DBUser, connInfo.DBPassword, sDBname) ) { var lsTabs = dbConn.GetTables(); var jss = new JavaScriptSerializer(); ret.sData = jss.Serialize(lsTabs); ret.retCode = true; } return(Json(ret)); }
private void LeftTree_FillNodeTables(TreeNode clkNode) { Cursor.Current = System.Windows.Forms.Cursors.AppStarting; clkNode.Nodes.Clear(); var dbNode = clkNode.Parent; var sDBName = dbNode.Text; m_connector.CurDBName = sDBName; using ( var dbConn = new NativeDBHelper(m_connector.DBHost, m_connector.DBUser, m_connector.DBPassword, sDBName) ) { var lsTabs = dbConn.GetTables(); foreach (var sTab in lsTabs) { var nodeTab = clkNode.Nodes.Add(sTab); nodeTab.ImageIndex = IMG_IND_TAB; nodeTab.SelectedImageIndex = IMG_IND_CUR; var nodeCol = nodeTab.Nodes.Add(MyRes.TXT_ALL_COL); nodeCol.ImageIndex = IMG_IND_COL; nodeCol.SelectedImageIndex = IMG_IND_CUR; nodeCol.Nodes.Add(STR_QUERYING); // } } clkNode.Expand(); Cursor.Current = System.Windows.Forms.Cursors.Default; }