Пример #1
0
        public List <ClsDBTablesAttributes> GetAllTablesNPrimaryColumns(string tblName)
        {
            DbWrapper objDataWrapper = new DbWrapper(Common.CnnString, CommandType.StoredProcedure);
            DataSet   ds             = new DataSet();

            List <ClsDBTablesAttributes> _objListClsDBTablesAttributes = new List <ClsDBTablesAttributes>();

            objDataWrapper.AddParameter("@tblName", tblName);
            ds = objDataWrapper.ExecuteDataSet("Aj_Proc_GetAllTables");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ClsDBTablesAttributes _objClsDBTablesAttributes = new ClsDBTablesAttributes();

                _objClsDBTablesAttributes.PropTABLENAME     = ds.Tables[0].Rows[i]["TABLE_NAME"].ToString();
                _objClsDBTablesAttributes.PropPK_COLUMNNAME = ds.Tables[0].Rows[i]["COLUMN_NAME"].ToString();
                _objListClsDBTablesAttributes.Add(_objClsDBTablesAttributes);
            }

            return(_objListClsDBTablesAttributes);
        }
Пример #2
0
        public List <ClsDBTablesAttributes> GetAllColumnsOfTable(string _strTableName, string AutoIncrementedColumnName)
        {
            DbWrapper objDataWrapper = new DbWrapper(Common.CnnString, CommandType.StoredProcedure);
            DataSet   ds             = new DataSet();

            List <ClsDBTablesAttributes> _objListClsDBTables = new List <ClsDBTablesAttributes>();

            objDataWrapper.AddParameter("@TableName", _strTableName);
            objDataWrapper.AddParameter("@AutoIncrementedColumnName", AutoIncrementedColumnName);
            ds = objDataWrapper.ExecuteDataSet("Aj_Proc_GetColumnsOfTable");


            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ClsDBTablesAttributes _objClsDBTablesAttributes = new ClsDBTablesAttributes();
                _objClsDBTablesAttributes.PropColumnName         = ds.Tables[0].Rows[i]["column_name"].ToString();
                _objClsDBTablesAttributes.PropDataType           = ds.Tables[0].Rows[i]["data_type"].ToString();
                _objClsDBTablesAttributes.PropColumnDTCharLength = ds.Tables[0].Rows[i]["charLength"].ToString();
                _objListClsDBTables.Add(_objClsDBTablesAttributes);
            }


            return(_objListClsDBTables);
        }