Click here to Skip to main content
15,894,405 members
Articles / Database Development / SQL Server

TreeToTable hierarchical tables with SQLServer 2005 and C#

Rate me:
Please Sign up or sign in to vote.
4.15/5 (12 votes)
12 Aug 20067 min read 43.6K   1.2K   51  
Retrieving child records from an hierarchical table
namespace TreeDemo
{
	partial class Form1
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.CreateDataButton = new System.Windows.Forms.Button();
			this.progressBar1 = new System.Windows.Forms.ProgressBar();
			this.LengthComboBox = new System.Windows.Forms.ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.DepthComboBox = new System.Windows.Forms.ComboBox();
			this.label3 = new System.Windows.Forms.Label();
			this.OrganizationCountLabel = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
			this.OrganizationRadioButton = new System.Windows.Forms.RadioButton();
			this.radioButton1 = new System.Windows.Forms.RadioButton();
			this.SuspendLayout();
			// 
			// CreateDataButton
			// 
			this.CreateDataButton.Location = new System.Drawing.Point(12, 108);
			this.CreateDataButton.Name = "CreateDataButton";
			this.CreateDataButton.Size = new System.Drawing.Size(250, 23);
			this.CreateDataButton.TabIndex = 1;
			this.CreateDataButton.Text = "create data";
			this.toolTip1.SetToolTip(this.CreateDataButton, "A tree is build with \'depth\' levels and \'length\' items at each level.");
			this.CreateDataButton.UseVisualStyleBackColor = true;
			this.CreateDataButton.Click += new System.EventHandler(this.CreateDataButton_Click);
			// 
			// progressBar1
			// 
			this.progressBar1.Location = new System.Drawing.Point(12, 143);
			this.progressBar1.Name = "progressBar1";
			this.progressBar1.Size = new System.Drawing.Size(250, 23);
			this.progressBar1.TabIndex = 2;
			// 
			// LengthComboBox
			// 
			this.LengthComboBox.FormattingEnabled = true;
			this.LengthComboBox.Items.AddRange(new object[] {
            "1",
            "2",
            "3",
            "4",
            "5",
            "6",
            "7",
            "8"});
			this.LengthComboBox.Location = new System.Drawing.Point(61, 12);
			this.LengthComboBox.Name = "LengthComboBox";
			this.LengthComboBox.Size = new System.Drawing.Size(42, 21);
			this.LengthComboBox.TabIndex = 3;
			this.LengthComboBox.Text = "2";
			this.toolTip1.SetToolTip(this.LengthComboBox, "A tree is build with \'depth\' levels and \'length\' items at each level.");
			this.LengthComboBox.SelectedIndexChanged += new System.EventHandler(this.LengthComboBox_SelectedIndexChanged);
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(12, 15);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(43, 13);
			this.label1.TabIndex = 4;
			this.label1.Text = "Length:";
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(12, 42);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(39, 13);
			this.label2.TabIndex = 6;
			this.label2.Text = "Depth:";
			// 
			// DepthComboBox
			// 
			this.DepthComboBox.FormattingEnabled = true;
			this.DepthComboBox.Items.AddRange(new object[] {
            "1",
            "2",
            "3",
            "4",
            "5",
            "6",
            "7",
            "8"});
			this.DepthComboBox.Location = new System.Drawing.Point(61, 39);
			this.DepthComboBox.Name = "DepthComboBox";
			this.DepthComboBox.Size = new System.Drawing.Size(42, 21);
			this.DepthComboBox.TabIndex = 5;
			this.DepthComboBox.Text = "3";
			this.toolTip1.SetToolTip(this.DepthComboBox, "A tree is build with \'depth\' levels and \'length\' items at each level.");
			this.DepthComboBox.SelectedIndexChanged += new System.EventHandler(this.DepthComboBox_SelectedIndexChanged);
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(58, 63);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(53, 13);
			this.label3.TabIndex = 7;
			this.label3.Text = "______ #";
			// 
			// OrganizationCountLabel
			// 
			this.OrganizationCountLabel.AutoSize = true;
			this.OrganizationCountLabel.Location = new System.Drawing.Point(61, 80);
			this.OrganizationCountLabel.Name = "OrganizationCountLabel";
			this.OrganizationCountLabel.Size = new System.Drawing.Size(13, 13);
			this.OrganizationCountLabel.TabIndex = 8;
			this.OrganizationCountLabel.Text = "0";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(9, 80);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(50, 13);
			this.label4.TabIndex = 9;
			this.label4.Text = "Records:";
			// 
			// toolTip1
			// 
			this.toolTip1.IsBalloon = true;
			this.toolTip1.ShowAlways = true;
			this.toolTip1.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info;
			// 
			// OrganizationRadioButton
			// 
			this.OrganizationRadioButton.AutoSize = true;
			this.OrganizationRadioButton.Checked = true;
			this.OrganizationRadioButton.Location = new System.Drawing.Point(136, 43);
			this.OrganizationRadioButton.Name = "OrganizationRadioButton";
			this.OrganizationRadioButton.Size = new System.Drawing.Size(110, 17);
			this.OrganizationRadioButton.TabIndex = 10;
			this.OrganizationRadioButton.TabStop = true;
			this.OrganizationRadioButton.Text = "Organization table";
			this.OrganizationRadioButton.UseVisualStyleBackColor = true;
			// 
			// radioButton1
			// 
			this.radioButton1.AutoSize = true;
			this.radioButton1.Location = new System.Drawing.Point(136, 66);
			this.radioButton1.Name = "radioButton1";
			this.radioButton1.Size = new System.Drawing.Size(122, 17);
			this.radioButton1.TabIndex = 11;
			this.radioButton1.TabStop = true;
			this.radioButton1.Text = "OrganizationInt table";
			this.radioButton1.UseVisualStyleBackColor = true;
			// 
			// Form1
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(274, 178);
			this.Controls.Add(this.radioButton1);
			this.Controls.Add(this.OrganizationRadioButton);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.OrganizationCountLabel);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.DepthComboBox);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.LengthComboBox);
			this.Controls.Add(this.progressBar1);
			this.Controls.Add(this.CreateDataButton);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Sample generator";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.ResumeLayout(false);
			this.PerformLayout();

		}

		#endregion

		private System.Windows.Forms.Button CreateDataButton;
		private System.Windows.Forms.ProgressBar progressBar1;
		private System.Windows.Forms.ComboBox LengthComboBox;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.ComboBox DepthComboBox;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label OrganizationCountLabel;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.ToolTip toolTip1;
		private System.Windows.Forms.RadioButton OrganizationRadioButton;
		private System.Windows.Forms.RadioButton radioButton1;
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions