I am fetching data of type image
from a MySQL database and convert it to a array of bytes.
I don't know how to handle it.
I have tried
byte[] b = (byte[])(sr1.image);
That wasn't successful. How can I convert a image
to a byte[]
?
I am fetching data of type image
from a MySQL database and convert it to a array of bytes.
I don't know how to handle it.
I have tried
byte[] b = (byte[])(sr1.image);
That wasn't successful. How can I convert a image
to a byte[]
?
private void ImagetoBinary(string FileName)
{
byte[] BinaryValue = ImageBinaryConvertion.ImageToBinary(FileName);
lblBinaryValue.Text = "Converted";
Image Image = ImageBinaryConvertion.BinaryToImage(BinaryValue);
pbImage.Image = Image;
}
private void btnImagePath_Click(object sender, EventArgs e)
{
string FileName = "";
OpenFileDialog OpenDig = new OpenFileDialog();
OpenDig.Filter = "All Files (*.*)|*.*";
OpenDig.FilterIndex = 1;
OpenDig.Multiselect = true;
if (OpenDig.ShowDialog() == DialogResult.OK)
{
FileName = OpenDig.FileName;
}
txtImagePath.Text = FileName.ToString();
ImagetoBinary(FileName);
}
Please use this code.