public static void GetPlusInformation(string tablename, string columnname, ref string labelName, ref bool isSearch, ref int searchPosition, ref bool isDetail, ref int detailPosition)
        {
            SQLBaseDataReader reader = GetReaderInformationPlus(tablename, columnname);

            string information = string.Empty;

            if (reader != null)
            {
                while (reader.Read())
                {
                    information = reader["DescriptionPlus"].ToString().Trim();

                    if (information.Equals(string.Empty))
                    {
                        if (information.IndexOf("*") != -1)
                        {
                        }
                        else
                        {
                            columnname = reader["DescriptionPlus"].ToString();
                        }
                    }
                    else
                    {
                        labelName = information;
                        labelName = columnname;
                    }
                }
                reader.Close();
            }
        }
        private static SQLBaseDataReader GetReaderInformationPlus(string tableName, string columnName)
        {
            string sqlDatabase = string.Format("SELECT value as DescriptionPlus FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', '{0}', 'column', '{1}')", tableName, columnName);

            SQLBaseConnection connection = new SQLBaseConnection(Session.ConnectionString);

            try
            {
                if (connection == null)
                {
                    return(null);
                }
                SQLBaseDataReader dr = SqlHelperSqlBase.ExecuteReader(connection, CommandType.Text, sqlDatabase);
                //    if (dr.HasRows)
                //        return dr;
                //    else
                return(null);
            }
            catch
            {
                return(null);
            }
        }
        public static ArrayList GetSchemaWebControls(SQLBaseDataReader dr)
        {
            ArrayList lobjTables = new ArrayList();
            ArrayList tables     = new ArrayList();

            if (dr != null)
            {
                string    oldTableName = string.Empty;
                DataTable table        = GetDatatableSchemaPlus();

                int j = 0;
                while (dr.Read())
                {
                    if (!dr.GetString(0).Equals("dtproperties"))
                    {
                        string newTableName     = dr.GetString(0);
                        string columnsName      = dr.GetString(1);
                        int    columnsMaxLength = dr[3].ToString().Equals(string.Empty) ? 0 : Int32.Parse(dr[3].ToString());
                        bool   columnsNullable  = dr.GetString(4).ToUpper().Equals("YES") ? true : false;

                        string columnsType   = GetSqlBaseType(columnsName, dr.GetString(2), columnsMaxLength, columnsNullable);
                        string columnsDBType = dr.GetString(2);


                        string labelName      = string.Empty;
                        bool   isSearch       = false;
                        int    searchPosition = 0;
                        bool   isDetail       = false;
                        int    detailPosition = 0;

                        if (oldTableName != newTableName)
                        {
                            if (oldTableName != string.Empty)
                            {
                                tables.Add(table);
                                j++;
                                table = GetDatatableSchemaWebControls();
                            }
                        }

                        GetPlusInformation(newTableName, columnsName, ref labelName, ref isSearch, ref searchPosition, ref isDetail, ref detailPosition);

                        DataRow row = table.NewRow();
                        row["Name"]           = columnsName;
                        row["Type"]           = columnsType;
                        row["DbType"]         = columnsDBType;
                        row["Length"]         = columnsMaxLength;
                        row["Nullable"]       = columnsNullable;
                        row["LabelName"]      = labelName;
                        row["isSearch"]       = isSearch;
                        row["SearchPosition"] = searchPosition;
                        row["isDetail"]       = isSearch;
                        row["DetailPosition"] = searchPosition;
                        row["Table"]          = newTableName;
                        table.Rows.Add(row);

                        oldTableName = newTableName;
                    }
                }
                tables.Add(table);
                return(tables);
            }
            return(null);
        }