标题:vb.net二进制流转换成图片
只看楼主
zhoushichuan
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2009-2-16
结帖率:100%
 问题点数:0 回复次数:1 
vb.net二进制流转换成图片
如何从sql2000数据库中读取出二进制流,并将二进制流转换成图片显示在网页上?

搜索更多相关主题的帖子: 图片 
2011-09-17 00:15
jianjunfeng
Rank: 3Rank: 3
等 级:论坛游侠
威 望:5
帖 子:42
专家分:166
注 册:2009-3-13
得分:0 
回复 楼主 zhoushichuan
    Public Sub 查找4(ByVal 字符 As String, ByVal Pi As PictureBox, ByVal FR As PictureBox, ByVal str As String)
        Dim sql As String = "select PIC from prdt where PRD_NO = '" & 字符 & "'"
        Dim sqlConn As SqlClient.SqlConnection = New SqlClient.SqlConnection(str)
        sqlConn.Open()
        On Error Resume Next
        Dim sqlCmd As New SqlClient.SqlCommand(sql, sqlConn)
         = CommandType.Text
        Dim bt As Byte() = sqlCmd.ExecuteScalar()
        '  MsgBox(Fstr & sql)
        If Not bt Is Nothing Then
            If bt.Length > 0 Then
                Dim fs As New MemoryStream(bt, True)
                fs.Write(bt, 0, bt.Length)
                fs.Position = 0
                Pi.Image = Image.FromStream(fs)
            Else
                Pi.Image = FR.Image
            End If
        Else
            Pi.Image = FR.Image
        End If
        sqlConn.Close()
        sqlConn = Nothing
    End Sub
引用 Dim stry As String = .Item(0, .CurrentCell.RowIndex).Value.ToString.Trim
                查找4(stry, Me.PictureBox1, Me.PictureBox2, Ftps)

Ftps 为连接SQL服务器的语句
2012-03-30 16:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-350111-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.941302 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved