vendredi 27 février 2015

Storing bitmap into sql

I'm coding an app for printing bills. I have a form within I load data. I want to automate printing, so in that order i save a bmp image of my filled form and then store into a mdf database for late print each row/cell (images in this case). But when i drag my table into a preview form (just for chek if i store data correctly) the id of each row appears, but i can't see that row's image... the question is: what am i doing wrong here? (i watched a lot o tutorials for last 3 days but i can't figure out yet what to do)



Public Sub toBitMap()
'Define un nuevo bitmap con las dimensiones del form
Dim miBitMap As New Bitmap(imprimir.Width, imprimir.Height)
' Dibuja la imagen del form en un objetoBitmap
imprimir.DrawToBitmap(miBitMap, New Rectangle(0, 0, imprimir.Width, imprimir.Height))
Dim memoryStreamBuffer = New MemoryStream()
miBitMap.Save(memoryStreamBuffer, ImageFormat.Bmp)
Dim data As Byte() = memoryStreamBuffer.GetBuffer()
Dim saveImage As imagenesTableAdapter = New imagenesTableAdapter
Dim a As String = saveImage.insertImagen(data)
If multiple.iteraciones <= 0 Then
cantidad = saveImage.ScalarQuery()
End If
End Sub

Aucun commentaire:

Enregistrer un commentaire