0

我在后端语言中使用带有 vb 的 asp.net2008。我想在 sql server 数据库中上传图像文件,以便将记录保存在数据库中。当我点击保存按钮时。并且还想在网格视图表中显示保存的图像数据。带有下载选项请帮助我

4

1 回答 1

0

你可以试试

注意:

调整您的查询

调整你的参数值(字节)

调整连接

        Dim connetionString As String
        Dim connection As SqlConnection
        Dim adapter As New SqlDataAdapter
        Dim sql As String

        connetionString = "......."
        connection = New SqlConnection(connetionString)

        sql = "...."
        Try
            connection.Open()

            Dim cmd As New SqlCommand(sql, connection)
            cmd.Parameters.Add("@Name", SqlDbType.VarBinary)

            Dim image As [Byte]()
            cmd.Parameters("@Name").Value = image

            adapter.InsertCommand = cmd
            adapter.InsertCommand.ExecuteNonQuery()
            MsgBox("Image inserted !! ")

        Catch ex As Exception
            ......
        End Try
于 2012-09-19T09:44:46.820 回答