Ejemplo n.º 1
0
        public AttributeFrm(DataTable dt, FCConnectionInfo info, string filterWhereClause)
        {
            InitializeComponent();

            AttriTable        = dt;
            Info              = info;
            FilterWhereClause = filterWhereClause;
        }
Ejemplo n.º 2
0
        private void toolStripMenuItemViewData_Click(object sender, EventArgs e)
        {
            string          fc_name  = selectNode.Text;
            string          set_name = selectNode.Parent.Text;
            myTreeNode      node     = (myTreeNode)selectNode.Parent.Parent;
            IConnectionInfo ci       = node.con;

            IDataSource     ds      = null;
            IFeatureDataSet dataset = null;
            IFeatureClass   fc      = null;

            try
            {
                ds      = dsFactory.OpenDataSource(ci);
                dataset = ds.OpenFeatureDataset(set_name);
                fc      = dataset.OpenFeatureClass(fc_name);

                IQueryFilter filter = new QueryFilter();
                int          nCount = fc.GetCount(filter);
                if (nCount == 0)
                {
                    return;
                }

                // 初始化表格
                DataTable dt = CreateDataTable(fc);
                // 查找数据
                GetResultSet(fc, filter, dt);
                // 显示表格
                FCConnectionInfo info = new FCConnectionInfo(ci, set_name, fc_name);
                new AttributeFrm(dt, info, filter.WhereClause).Show();
            }
            catch (COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
            finally
            {
                if (ds != null)
                {
                    //Marshal.ReleaseComObject(ds);
                    ds = null;
                }
                if (dataset != null)
                {
                    //Marshal.ReleaseComObject(dataset);
                    dataset = null;
                }
                if (fc != null)
                {
                    //Marshal.ReleaseComObject(fc);
                    fc = null;
                }
            }
        }