Torna al Thread

Private Function RecuperaIdImgData(ByVal idRecord As Integer) As Image Dim cn As New SqlConnection(strCn) Dim cmd As New SqlCommand("SELECT BLOBID, BLOBData FROM BLOBTest WHERE BLOBID = " + idRecord.ToString(), cn) Dim da As New SqlDataAdapter(cmd) Dim ds As New DataSet() Dim img As Image = Nothing da.Fill(ds, "BLOBTest") Dim c As Integer = ds.Tables("BLOBTest").Rows.Count If (c > 0) Then Dim bytBLOBData() As Byte = _ ds.Tables("BLOBTest").Rows(c - 1)("BLOBData") Dim stmBLOBData As New MemoryStream(bytBLOBData) img = Image.FromStream(stmBLOBData) End If Return img End Function
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5