Question: My program loads data from a MySQL database into a `DataGridView`. I want to hide the first column (`id` column), but I get the reentrance cell error.

CODE:

```
void dataGridGlavni_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
    {
        if (this.dataGridGlavni.Columns[e.ColumnIndex].Name == "id")
        {
            this.dataGridGlavni.Columns[e.ColumnIndex].Visible = false; // <<<< error
        }
        if (this.dataGridGlavni.Columns[e.ColumnIndex].Name == "Plate za mesec")
        {
            GlavniForm.ShortFormDateFormat(e);
        }
    }

```

ERROR:

> 
> Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.
> 
> 
> 

The error also appears when I use the following line:

```
this.dataGridGlavni.Columns[0].Visible = false;

```

However it does NOT appear when I use these lines:

```
this.dataGridGlavni.Columns[1].Visible = false;

```

OR

```
this.dataGridGlavni.Columns["Plate za mesec"].Visible = false;

```

I googled a lot and haven't been able to find the source of the error. What is happening why won't it let me hide the first column ?

Thank you

Answer: 
***Check Database Size in SQL Server for both Azure and On-Premises-***

**Method 1 – Using ‘sys.database\_files’ System View**

```
SELECT
    DB_NAME() AS [database_name],
    CONCAT(CAST(SUM(
        CAST( (size * 8.0/1024) AS DECIMAL(15,2) )
    ) AS VARCHAR(20)),' MB') AS [database_size]
FROM sys.database_files;

```

[![enter image description here](https://i.stack.imgur.com/VgoDT.png)](https://i.stack.imgur.com/VgoDT.png)

**Method 2 – Using ‘sp\_spaceused’ System Stored Procedure**

```
EXEC sp_spaceused ;

```

[![enter image description here](https://i.stack.imgur.com/V26lM.png)](https://i.stack.imgur.com/V26lM.png)
If you would like to get size of real data, you'll need to filter 'ONLINE' data files only. Otherwise you can get a size that significately different from the size you see in GUI. Some ghost | old garbage records can be in the sys.master\_files, for example 'DEFUNCT' data files.

```
    with fs
    as
    (
        select database_id, type, size * 8.0 / 1024 size, physical_name
        from sys.master_files
        where state_desc = 'ONLINE' -- ONLINE,RESTORING,RECOVERING,RECOVERY_PENDING,SUSPECT,,OFFLINE, DEFUNCT
    )
    select 
        name,
        (select sum(size) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeMB,
        (select sum(size) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeMB,
        (select sum(size) from fs where fs.database_id = db.database_id) TotalFileSizeMB
    from sys.databases db
    --order by database_id
    order by TotalFileSizeMB desc

```