Exemple #1
0
        //重载,added by xisheng 2011.06.16
        public void InitDataInfoList(string strTblName, bool boolreturn)
        {
            if (strTblName.Equals(""))
            {
                return;
            }
            IWorkspace pTmpWorkSpace = Plugin.ModuleCommon.TmpWorkSpace;

            if (pTmpWorkSpace == null)
            {
                return;
            }
            ModDBOperate.boolreturn = boolreturn;
            DataTable pDatatable = ModDBOperate.GetQueryTable(pTmpWorkSpace as IFeatureWorkspace, strTblName, "");

            m_dataTable = pDatatable;
            this.gridControl.DataSource = null;
            this.gridControl.DataSource = pDatatable;
        }
Exemple #2
0
        //根据tblName获取对应的数据信息填充到listview中
        public void InitDataInfoList(string strTblName)
        {
            if (strTblName.Equals(""))
            {
                return;
            }
            IWorkspace pTmpWorkSpace = Plugin.ModuleCommon.TmpWorkSpace;

            if (pTmpWorkSpace == null)
            {
                return;
            }

            /* SysCommon.Gis.SysGisTable pSystable = new SysCommon.Gis.SysGisTable(pTmpWorkSpace);
             * Exception eError = null;
             * ITable pTable = pSystable.OpenTable(strTblName, out eError);
             * if (pTable == null)
             * {
             *   return;
             * }
             * DataTable pDatatable = new DataTable();
             * DataRow pRow = pDatatable.NewRow();
             * DataColumn pColumn = new DataColumn();
             *
             * this.gridControl.DataSource = null;
             * this.gridControl.DataSource = pTable;*/
            DataTable pDatatable = ModDBOperate.GetQueryTable(pTmpWorkSpace as IFeatureWorkspace, strTblName, "");

            m_dataTable = pDatatable;
            this.gridControl.DataSource = null;
            this.gridControl.DataSource = pDatatable;

            //目前直接读取mdb文件,需要修改为配置模式

/*            GetDataTreeInitIndex dIndex = new GetDataTreeInitIndex();
 *          string mypath = dIndex.GetDbInfo();
 *          //string  mypath = dIndex.GetDbValue("dbServerPath");
 *          string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mypath + ";Mode=ReadWrite|Share Deny None;Persist Security Info=False";  //生成连接数据库字符串
 *          m_connstr = constr;
 *          OleDbConnection mycon = new OleDbConnection(constr);   //定义OleDbConnection对象实例并连接数据库
 *          string strExp = "";
 *          strExp = "select * from " + strTblName;
 *          OleDbCommand aCommand = new OleDbCommand(strExp, mycon);
 *          try
 *          {
 *              mycon.Open();
 *
 *              //创建datareader   对象来连接到表单
 *              OleDbDataReader aReader = aCommand.ExecuteReader();
 *              DataTable dt = new DataTable();
 *              OleDbDataAdapter da = new OleDbDataAdapter(strExp, constr);
 *              m_Adapter = null;
 *              m_dataTable = null;
 *              m_Adapter = da;
 *              m_dataTable = dt;
 *              da.Fill(dt);
 *              this.gridControl.DataSource = null;
 *              this.gridControl.DataSource = dt;
 *
 *
 *              //关闭reader对象
 *              aReader.Close();
 *
 *              //关闭连接,这很重要
 *              mycon.Close();
 *
 *          }
 *          catch (System.Exception e)
 *          {
 *              Console.WriteLine(e.Message);
 *          }
 */

            //获取数据库中的内容
        }