Well, getDataBuffer is only contracted to return a "DataBuffer", whether that "DataBuffer" is a "DataBufferByte" or "DataBufferInt", I would assume varies from image type to image type, and, seemingly, your compress method winds up changing it the to different type than what "createScreenCapture" returns, thereby changing the type of "DataBuffer" that underlies the image.
If you need the int color values array behind an image (and you have a BufferedImage anyway) then use the getRGB(int startX, int startY, int w, int h, int rgbArray, int offset, int scansize) method.
Dim Adapter As New OleDbDataAdapter
Dim Command As New OleDbCommand
Dim xFrom As String = dtpFrom.Value.ToString.Substring(0, dtpFrom.Value.ToString.IndexOf(" "))
Dim xTo As String = dtpTo.Value.ToString.Substring(0, dtpTo.Value.ToString.IndexOf(" "))
sqlQuery = MainQuery ...