public frmMaxCadastraQuery(IFeatureClass JFFeatureClass, IFeatureClass ZDFeatureClass, AxMapControl pMapControl, IWorkspace pWorkspace) { InitializeComponent(); CommnClass.m_JFFeatureClass = JFFeatureClass; CommnClass.m_ZDFeatureClass = ZDFeatureClass; CommnClass.m_cmbBoxCountry = ""; CommnClass.m_cmbBoxVillage = ""; CommnClass.m_cmbBoxNeighbour = ""; CommnClass.m_JFLike = "%"; CommnClass.m_ZDLike = "%"; CommnClass.m_Workspace = pWorkspace; m_MapControl = pMapControl; CommnClass.m_ZDLike = CommnClass.GetDescriptionOfWorkspace((ZDFeatureClass as IDataset).Workspace); CommnClass.m_JFLike = CommnClass.GetDescriptionOfWorkspace((JFFeatureClass as IDataset).Workspace); CommnClass.SetcmbBoxCountryVale(cmbBoxCountry); //wgf 20111014 从数据中获取修改为从行政区字典中获取 //?/???? }
/// <summary> /// 根据用户输入的表达式进行查询 /// </summary> /// <param name="pLabel"></param> /// <param name="strTable"></param> /// <param name="StrQueryValue"></param> /// <param name="pFeatureClass"></param> /// <param name="pDataGridView"></param> public static void Query(DevComponents.DotNetBar.LabelX pLabel, string strTable, string StrQueryValue, IFeatureClass pFeatureClass, DevComponents.DotNetBar.Controls.DataGridViewX pDataGridView) { //进度条 SysCommon.CProgress pgss = new SysCommon.CProgress("正在查询,请稍候..."); pgss.EnableCancel = false; pgss.ShowDescription = false; pgss.FakeProgress = true; pgss.TopMost = true; pgss.ShowProgress(); try { IFeatureWorkspace pFeatureWorkspace = m_Workspace as IFeatureWorkspace; ITable pTable = pFeatureWorkspace.OpenTable(strTable); string strFieldName = pLabel.Tag.ToString(); string strLike = CommnClass.GetDescriptionOfWorkspace((pFeatureClass as IDataset).Workspace); pDataGridView.Columns["CumQueryName"].HeaderText = pLabel.Text.Substring(0, pLabel.Text.Length - 1); pDataGridView.Rows.Clear(); IField pField = pTable.Fields.get_Field(pTable.FindField(strFieldName)); IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.WhereClause = pField.Name + " Like '" + strLike + StrQueryValue + strLike + "'"; ICursor pCursor = pTable.Search(pQueryFilter, false); IRow pRow = pCursor.NextRow(); while (pRow != null) { string strFieldVlaue = pRow.get_Value(pRow.Fields.FindField(strFieldName)).ToString(); string strDJHVlaue = pRow.get_Value(pRow.Fields.FindField("DJH")).ToString(); string strFeatureID = GetFeatuerID(pFeatureClass, strDJHVlaue); pDataGridView.Rows.Add(strFieldVlaue, strDJHVlaue, strFeatureID); pRow = pCursor.NextRow(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(pCursor); pCursor = null; pgss.Close(); } catch { } finally { pgss.Close(); } }
public frmMaxCadastraQuery(IFeatureClass ZDFeatureClass, string LinBanCodeField, string XzqField, AxMapControl pMapControl, IWorkspace pWorkspace) { InitializeComponent(); _LinBanCodeFieldName = LinBanCodeField; _XzqFieldName = XzqField; CommnClass._DJHFieldName = LinBanCodeField; CommnClass._JFDMFieldName = XzqField; CommnClass._JFMCFieldName = XzqField; CommnClass.m_JFFeatureClass = null; CommnClass.m_ZDFeatureClass = ZDFeatureClass; CommnClass.m_cmbBoxCountry = ""; CommnClass.m_cmbBoxVillage = ""; CommnClass.m_cmbBoxNeighbour = ""; CommnClass.m_JFLike = "%"; CommnClass.m_ZDLike = "%"; CommnClass.m_Workspace = pWorkspace; m_MapControl = pMapControl; CommnClass.m_ZDLike = CommnClass.GetDescriptionOfWorkspace((ZDFeatureClass as IDataset).Workspace); //CommnClass.m_JFLike = CommnClass.GetDescriptionOfWorkspace((JFFeatureClass as IDataset).Workspace); CommnClass.SetcmbBoxCountryVale(cmbBoxCountry); //wgf 20111014 从数据中获取修改为从行政区字典中获取 //?/???? }