vb.net return image field value with Null value in database Sql server 2015

0

I'm trying to return a Null value in the image column of image type in sql server 2015 database in visual basic (visual studio 2015), but I do not know which parameter to pass in if, because it claims the following error:

  

It is not possible to convert an object of type 'System.DBNull' to type 'System.Byte []'.

Thanks for the help!

If Not ("Lider").Equals(DBNull.Value) Then
    Me.txtLider.Text = Me.dgvAgenda.CurrentRow.Cells("Lider").Value.ToString
Else
    Me.txtLider.Text = String.Empty
End If

If Not ("Ativo").Equals(DBNull.Value) Then
    Me.chbAtivo.Checked = Me.dgvAgenda.CurrentRow.Cells("Ativo").Value.ToString
Else
    Me.chbAtivo.Checked = String.Empty
End If

Dim ms As New MemoryStream(ObtemImagem(CByte(dgvAgenda.SelectedCells(0).Value)))
picImagem.Image = Image.FromStream(ms)
    
asked by anonymous 18.06.2018 / 21:59

0 answers