⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcontent.cs

📁 地理信息 地理信息 地理信息 地理信息
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace MainSystem
{
	/// <summary>
	/// Summary description for frmContent.
	/// </summary>
	public class frmContent : System.Windows.Forms.Form
	{
		CEnvironment	_env = null;
		string			_szName;

		private System.Windows.Forms.ListBox _listBox;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmContent(CEnvironment env)
		{
			_env = env;
			InitializeComponent();
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(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._listBox = new System.Windows.Forms.ListBox();
			this.SuspendLayout();
			// 
			// _listBox
			// 
			this._listBox.Dock = System.Windows.Forms.DockStyle.Fill;
			this._listBox.ItemHeight = 12;
			this._listBox.Name = "_listBox";
			this._listBox.Size = new System.Drawing.Size(216, 208);
			this._listBox.TabIndex = 1;
			// 
			// frmContent
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(216, 213);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this._listBox});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "frmContent";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "详细信息";
			this.Load += new System.EventHandler(this.frmContent_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmContent_Load(object sender, System.EventArgs e)
		{
			if ("" == _szName)
				return;

			string szTableName = _env.GetTableName(_szName,"地名索引");
			if ("" == szTableName)
			{
				MessageBox.Show("属性库中无此地名!","中国地名指南",MessageBoxButtons.OK,MessageBoxIcon.Error ); 
				return;
			}
			_listBox.Items.Clear();
  
			string strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _env.m_szDBName + 
				";Persist Security Info=False";		
			System.Data.OleDb.OleDbConnection  myConnection = new System.Data.OleDb.OleDbConnection(strConnectionString);   
			myConnection.Open();
			System.Data.DataSet dataSet = new System.Data.DataSet("临时库");
			System.Data.OleDb.OleDbDataAdapter myDataAdapter;

			string szSQL;
			string szFieldName;			
			szFieldName = this._env.GetFieldName(_szName);
  
			if (szFieldName == "")
				szFieldName = "单位名称";

			szSQL = "Select * From [" + szTableName + "] Where "+ szFieldName+" ='"+_szName+"'";

			myDataAdapter = new System.Data.OleDb.OleDbDataAdapter(szSQL,myConnection);
				
			try
			{
				myDataAdapter.Fill(dataSet,"地名");
			}
			finally
			{
			}

			System.Data.DataTable indexTbl = dataSet.Tables["地名"];
		
			System.Data.DataRow[] rowsType = indexTbl.Select();

			if (0 == rowsType.Length)
				return ;

			for (int i = 0; i < indexTbl.Columns.Count; i ++)
			{	
				string szValue = indexTbl.Columns[i].ColumnName + ":" + rowsType[0][i].ToString(); 
				_listBox.Items.Add(szValue); 
			}
		}


		public void SetName(string szName)
		{
			_szName = szName;
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -