Reputation: 349
I have a datagridview that are connected to a table in SQL database.
There is a column of type VARBINARY(MAX)
that store a sequence of bytes.
How can I extract these bytes from the grid view?
my code is:
byte [] a = datagridview.CurrentRow.Cells[4].Value;
in which cell[4]
contain the bytes.
but it gives an error:
cannot implicitly convert type Object To byte[]
Upvotes: 1
Views: 2812
Reputation: 263
Try casting the right hand side like this
byte [] a = (byte [])datagridview.CurrentRow.Cells[4].Value;
Upvotes: 1