Example #1
0
        /// <summary>
        /// 获取指定的表字段
        /// </summary>
        /// <param name="TableName"></param>
        /// <returns></returns>
        public List <string> GetSystemFieldList(string TableName)
        {
            //string dllName = System.Windows.Forms.Application.StartupPath + "\\HIS.Entity.dll";
            //Assembly assembly = Assembly.LoadFile( dllName );
            //string typeName = "HIS.Model." + TableName;
            //object obj = assembly.CreateInstance( typeName, true );
            //List<string> lstField = new List<string>();
            //if ( obj != null )
            //{
            //    PropertyInfo[] properies = obj.GetType().GetProperties();
            //    for ( int i = 0; i < properies.Length; i++ )
            //    {
            //        lstField.Add( properies[i].Name );
            //    }
            //}
            //return lstField;
            DataRow[]     drsFields = BaseDataController.GetTableColumn().Select("TBNAME='" + TableName + "'");
            List <string> lstField  = new List <string>();

            foreach (DataRow dr in drsFields)
            {
                lstField.Add(dr["NAME"].ToString().Trim());
            }
            return(lstField);
        }
Example #2
0
        private void FrmCreatePYWB_Load(object sender, EventArgs e)
        {
            tbColumns = BaseDataController.GetTableColumn( );
            DataTable tbTables = new DataTable( );

            tbTables.Columns.Add("TBNAME");
            for (int i = 0; i < tbColumns.Rows.Count; i++)
            {
                string tbName = tbColumns.Rows[i]["TBNAME"].ToString( ).Trim( );
                if (tbTables.Select("TBNAME='" + tbName + "'").Length == 0)
                {
                    tbTables.Rows.Add(tbName);
                }
            }
            cboTable.DisplayMember         = "TBNAME";
            cboTable.ValueMember           = "TBNAME";
            cboTable.DataSource            = tbTables;
            cboTable.SelectedIndex         = -1;
            cboTable.SelectedIndexChanged += new EventHandler(cboTable_SelectedIndexChanged);
        }