繁体   English   中英

103666 vb.net,用于在扫描后将图像保存在图像文件夹和数据库中

[英]103666 vb.net for saving image in image folder and in database after scanning

我正在从事一个与将从扫描仪捕获的图像保存在文件夹和数据库中有关的项目。 扫描执行正常,但是当我将图像保存在磁盘上以及数据库中的路径时,出现以下错误

数据库-表名-图像列-(File_Name,varchar50,null = true),(Image,nvarchar(Max),null = true)

我的代码如下:

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
    ''SCAN THE IMAGE AND SAVE TO PROJECT FOLDER AND IN DATABASE (AS BLOB)
    If True Then
        ' Scanner selected?
        Dim device = TryCast(Devices.SelectedItem, Scanner)
        If device Is Nothing Then
            MessageBox.Show("Please select a device.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            Return
        End If

        ' Scan
        Dim image = device.Scan()

        'Save the image

        'Dim path = "image/"
        'If File.Exists(path) Then
        '    File.Delete(path)
        'End If
        'image.SaveFile(TextBox1.Text, "image/")
        'image.save()


    End If

End Sub

表格设计存在一些问题:

1)文件名(最多50个字符)很可能不够长,尤其是在包含路径的情况下。

2)将图像数据存储在nvarchar中很可能会引起许多问题。 使用varbinary会更好。 这是来自Microsoft的一些信息的链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM