我有一个Windows窗体应用程序,我想将屏幕截图存储在我的SQL服务器数据库中。到目前为止,这是我的代码:
Dim bounds As Rectangle = CaptureBox.Bounds
Dim pt As Point = CaptureBox.PointToScreen(bounds.Location)
Dim bitmap As New Bitmap(bounds.Width, bounds.Height)
Using g As Graphics = Graphics.FromImage(bitmap)
g.CopyFromScreen(New Point(pt.X - CaptureBox.Location.X, pt.Y - CaptureBox.Location.Y), Point.Empty, bounds.Size)
End Using
Dim bytes() As Byte
Dim converter As New ImageConverter()
bytes = converter.ConvertTo(bitmap, GetType(Byte()))
我只需要帮助插入SQL
,任何指针?
答案 0 :(得分:1)
只需创建SQL表和类型为image的列。您只需将其插入为字节。
要加载图像,请从该列中读取字节
Mockito.eq