fyiReporting.RdlDesign.SQLCtl.InitValues C# (CSharp) Method

InitValues() private method

private InitValues ( string sql ) : void
sql string
return void
        private void InitValues(string sql)
        {
            this.tbSQL.Text = sql.Replace("\r\n", "\n").Replace("\n", Environment.NewLine);

            // Fill out the tables, columns and parameters

            // suppress redraw until tree view is complete
            tvTablesColumns.BeginUpdate();

            // Get the schema information
            List<SqlSchemaInfo> si = DesignerUtility.GetSchemaInfo(_Draw, _DataSource);
            if (si != null && si.Count > 0)
            {
                TreeNode ndRoot = new TreeNode("Tables");
                tvTablesColumns.Nodes.Add(ndRoot);
                if (si == null)		// Nothing to initialize
                    return;
                bool bView = false;
                foreach (SqlSchemaInfo ssi in si)
                {
                    if (!bView && ssi.Type == "VIEW")
                    {	// Switch over to views
                        ndRoot = new TreeNode("Views");
                        tvTablesColumns.Nodes.Add(ndRoot);
                        bView = true;
                    }

                    // Add the node to the tree
                    TreeNode aRoot = new TreeNode(ssi.Name);
                    ndRoot.Nodes.Add(aRoot);
                    aRoot.Nodes.Add("");
                }
            }
            // Now do parameters
            TreeNode qpRoot = null;
            foreach (DataRow dr in _QueryParameters.Rows)
            {
                if (dr[0] == DBNull.Value || dr[1] == null)
                    continue;
                string pName = (string)dr[0];
                if (pName.Length == 0)
                    continue;
                if (qpRoot == null)
                {
                    qpRoot = new TreeNode("Query Parameters");
                    tvTablesColumns.Nodes.Add(qpRoot);
                }
                if (pName[0] != '@')
                {
                    pName = "@" + pName;
                }
                // Add the node to the tree
                TreeNode aRoot = new TreeNode(pName);
                qpRoot.Nodes.Add(aRoot);
            }

            tvTablesColumns.EndUpdate();
        }