C# DataGridView不会显示数据库中包含空图像的所有值

C# DataGridView不会显示数据库中包含空图像的所有值,c#,mysql,.net,visual-studio,datagridview,C#,Mysql,.net,Visual Studio,Datagridview,DataGridView不会显示数据库中包含空图像的所有值 显示数据库中的数据时出现问题。我使用MySql。我有一个带图像的字段,它可以有一个空值 但是,当我试图从MySql显示DataGridView中的所有记录时,它只显示其中包含图像的记录。 但在进行搜索时,会出现一些字符串,这些字符串可以在没有图像的情况下显示。 有什么问题吗? 也许问题就在这里: public void GetViewImageInCellTable(DataGridView dataGridView, int numb

DataGridView
不会显示数据库中包含空图像的所有值

显示数据库中的数据时出现问题。我使用MySql。我有一个带图像的字段,它可以有一个空值

但是,当我试图从MySql显示
DataGridView
中的所有记录时,它只显示其中包含图像的记录。
但在进行搜索时,会出现一些字符串,这些字符串可以在没有图像的情况下显示。
有什么问题吗?
也许问题就在这里:

public void GetViewImageInCellTable(DataGridView dataGridView, int numberColumn)
{
   DataGridViewImageColumn imgCol = new DataGridViewImageColumn();
   imgCol = (DataGridViewImageColumn)dataGridView.Columns[numberColumn];
   imgCol.ImageLayout = DataGridViewImageCellLayout.Stretch;
}

只需启动datagridView,不显示空值字段,仅显示图片。


但在查找值时,会显示空值。为什么?

您可以添加gridview的代码并提供更多信息吗?我将添加映射数据中涉及的完整代码。只需启动datagridView未显示的字段,其中包含空值,仅包含图片。但在查找值时,会显示空值。为什么?
        public void FillDataGridView(DataGridView dataGridView,  int height, int[] cellsImages, string query = "")
    {
        try
        {
            command = new MySqlCommand(query, connection); //Создаём запрос для поиска
            adapter = new MySqlDataAdapter(command); //Выполняем команду
                                                     //Для отображения в таблице
            DataTable table = new DataTable(); //Создаём таблицу
            adapter.Fill(table); //Вставляем данные при выполнении команды в таблицу

            Settings settings = new Settings();
            //настраиваем отображение таблицы
            settings.GetSettingDisplayTable(dataGridView, height);
            dataGridView.DataSource = table; //подключаем заполненную таблицу и отображаем
            //Для отображения картинки в DataGridView
            settings.GetViewImageInCellTable(dataGridView, cellsImages);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
        public void GetSettingDisplayTable(DataGridView dataGridView, int height)
    {
        dataGridView.RowTemplate.Height = height; //высота строк
        dataGridView.AllowUserToAddRows = false; //нельзя пользователю добавлять самому строки
        //Как будет отображаться таблица
        dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        //Растягивать таблицу (колонки) под окно dataGridView
    }