Hi all,
i am trying to save a small image to an access table, as an OLE Object, using an INSERT SQL query. Problem is that image, depending on wich format I choose when inserting, when I try to load it into a picturebox, it looks corrupted, as if only some pixels where saved, the rest of the image is gray. (This occurs with PNG, JPEG). When saving with BMP, no image at all, and using GIF, gives me a black image.
I use following code to insert the image into database:
I know there are a lot of questions about similar topics, but I could not find a solution. Could anyone please give me a hint?
Thanks in advance
A.
i am trying to save a small image to an access table, as an OLE Object, using an INSERT SQL query. Problem is that image, depending on wich format I choose when inserting, when I try to load it into a picturebox, it looks corrupted, as if only some pixels where saved, the rest of the image is gray. (This occurs with PNG, JPEG). When saving with BMP, no image at all, and using GIF, gives me a black image.
I use following code to insert the image into database:
Code:
Dim ms As New MemoryStream
pictBoxLogo.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif)
Dim logo() As Byte = ms.GetBuffer
ms.Close()
InformesTableAdapter.ActualizarInforme(EmpresaTBox.Text, _
EntrevistasDelegadosTbox.Text, _
EntrevistasTrabajadoresTbox.Text, _
FechaInformeTbox.Text, _
LocalidadTbox.Text, _
logo, _
numEntrevistasTbox.Text, _
PlantillaTbox.Text, _
PorcentajePlantillaTbox.Text, _
InformeComboBox.SelectedValue)
Thanks in advance
A.