From 82318dd0ca5d2371e3788b574a8f1edebaf2dca7 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 28 Jun 2004 23:37:38 +0000 Subject: Tightened database connection. Fixed some form design problems. --- MainForm.cs | 63 +++++++++++++++++++++++++++++++---------------------------- TLReader.prjx | 1 - 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index 3fa3257..ab85f97 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -34,16 +34,15 @@ namespace TLReader private System.Windows.Forms.Button m_quitButton; private System.Windows.Forms.Label label2; private System.Windows.Forms.CheckBox m_sortOrder; - private System.Windows.Forms.Button m_aboutButton; + private System.Windows.Forms.ProgressBar m_progress; private System.Windows.Forms.Label label; private System.Windows.Forms.ComboBox m_sortBy; private System.Windows.Forms.Button m_csvButton; private System.Windows.Forms.ListView m_list; private System.Windows.Forms.TextBox m_noRowsText; - private System.Windows.Forms.ProgressBar m_progress; + private System.Windows.Forms.Button m_aboutButton; private System.Windows.Forms.Button m_sortButton; - private OdbcConnection m_dbase; private Query m_query; private TLConfig m_config; private StringCollection m_colDesc; @@ -58,11 +57,7 @@ namespace TLReader m_config=Config.Load(); - m_dbase=new OdbcConnection(m_config.Connect); - - m_dbase.Open(); - - Text+=" - "+m_dbase.Database; + Text+=" - "+m_config.Connect; m_colDesc=Util.Split(m_config.DisplayNames); m_colName=Util.Split(m_config.ColumnNames); @@ -115,13 +110,13 @@ namespace TLReader /// private void InitializeComponent() { this.m_sortButton = new System.Windows.Forms.Button(); - this.m_progress = new System.Windows.Forms.ProgressBar(); + this.m_aboutButton = new System.Windows.Forms.Button(); this.m_noRowsText = new System.Windows.Forms.TextBox(); this.m_list = new System.Windows.Forms.ListView(); this.m_csvButton = new System.Windows.Forms.Button(); this.m_sortBy = new System.Windows.Forms.ComboBox(); this.label = new System.Windows.Forms.Label(); - this.m_aboutButton = new System.Windows.Forms.Button(); + this.m_progress = new System.Windows.Forms.ProgressBar(); this.m_sortOrder = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label(); this.m_quitButton = new System.Windows.Forms.Button(); @@ -129,7 +124,6 @@ namespace TLReader // // m_sortButton // - this.m_sortButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.m_sortButton.Location = new System.Drawing.Point(568, 8); this.m_sortButton.Name = "m_sortButton"; this.m_sortButton.Size = new System.Drawing.Size(104, 32); @@ -137,21 +131,22 @@ namespace TLReader this.m_sortButton.Text = "Sort"; this.m_sortButton.Click += new System.EventHandler(this.OnSort); // - // m_progress + // m_aboutButton // - this.m_progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.m_progress.Location = new System.Drawing.Point(128, 512); - this.m_progress.Name = "m_progress"; - this.m_progress.Size = new System.Drawing.Size(304, 16); - this.m_progress.TabIndex = 3; + this.m_aboutButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.m_aboutButton.Location = new System.Drawing.Point(8, 504); + this.m_aboutButton.Name = "m_aboutButton"; + this.m_aboutButton.Size = new System.Drawing.Size(104, 32); + this.m_aboutButton.TabIndex = 4; + this.m_aboutButton.Text = "About"; + this.m_aboutButton.Click += new System.EventHandler(this.OnAbout); // // m_noRowsText // this.m_noRowsText.Location = new System.Drawing.Point(104, 8); this.m_noRowsText.Name = "m_noRowsText"; this.m_noRowsText.ReadOnly = true; - this.m_noRowsText.Size = new System.Drawing.Size(72, 20); + this.m_noRowsText.Size = new System.Drawing.Size(72, 21); this.m_noRowsText.TabIndex = 6; this.m_noRowsText.TabStop = false; this.m_noRowsText.Text = "textBox"; @@ -161,10 +156,12 @@ namespace TLReader this.m_list.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.m_list.BackColor = System.Drawing.SystemColors.Info; this.m_list.FullRowSelect = true; this.m_list.GridLines = true; this.m_list.HideSelection = false; this.m_list.Location = new System.Drawing.Point(8, 48); + this.m_list.MultiSelect = false; this.m_list.Name = "m_list"; this.m_list.Size = new System.Drawing.Size(664, 440); this.m_list.TabIndex = 2; @@ -197,15 +194,14 @@ namespace TLReader this.label.Text = "Number of Rows"; this.label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // m_aboutButton + // m_progress // - this.m_aboutButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.m_aboutButton.Location = new System.Drawing.Point(8, 504); - this.m_aboutButton.Name = "m_aboutButton"; - this.m_aboutButton.Size = new System.Drawing.Size(104, 32); - this.m_aboutButton.TabIndex = 4; - this.m_aboutButton.Text = "About"; - this.m_aboutButton.Click += new System.EventHandler(this.OnAbout); + this.m_progress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.m_progress.Location = new System.Drawing.Point(128, 512); + this.m_progress.Name = "m_progress"; + this.m_progress.Size = new System.Drawing.Size(304, 16); + this.m_progress.TabIndex = 3; // // m_sortOrder // @@ -238,7 +234,7 @@ namespace TLReader // // MainForm // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.ClientSize = new System.Drawing.Size(680, 541); this.Controls.Add(this.m_sortOrder); this.Controls.Add(this.m_sortButton); @@ -251,7 +247,7 @@ namespace TLReader this.Controls.Add(this.m_list); this.Controls.Add(this.m_csvButton); this.Controls.Add(this.m_quitButton); - this.MinimumSize = new System.Drawing.Size(420, 200); + this.MinimumSize = new System.Drawing.Size(688, 568); this.Name = "MainForm"; this.Text = "Tuglist Reader"; this.ResumeLayout(false); @@ -322,9 +318,16 @@ namespace TLReader string sort=m_colName[m_sortBy.SelectedIndex]; string order=m_sortOrder.Checked ? "asc":"desc"; - m_query=new Query(m_dbase, + OdbcConnection dbase=new OdbcConnection(m_config.Connect); + + dbase.Open(); + + m_query=new Query(dbase, m_config.DisplayNames, m_config.Query+" order by "+sort+" "+order); + + dbase.Close(); + FillList(); m_noRowsText.Text=m_query.Count.ToString(); diff --git a/TLReader.prjx b/TLReader.prjx index 6229aba..f66e338 100644 --- a/TLReader.prjx +++ b/TLReader.prjx @@ -11,7 +11,6 @@ - -- cgit v1.2.3