截取并存储在SQL VB.NET中

时间:2017-05-17 06:05:17

标签: sql-server vb.net

我有一个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,任何指针?

1 个答案:

答案 0 :(得分:1)

只需创建SQL表和类型为image的列。您只需将其插入为字节。

要加载图像,请从该列中读取字节

Mockito.eq