sb.Remove(0, sb.Length)
sb.Append("select*from tb_img")
Dim sqlselect As String = sb.ToString()
com = New SqlCommand
With com
.CommandType = CommandType.Text
.CommandText = sqlselect
.Parameters.Clear()
.Connection = con
da = .ExecuteReader
With da.Read
Dim Picture() As Byte = CType(da("IMGE"), Byte())
Dim GetPictrue As New System.IO.MemoryStream(Picture)
PictureBox1.Image = Image.FromStream(GetPictrue)
End With
da.Close()
End With
Tag : .NET, Ms SQL Server 2008, Win (Windows App), VS 2010 (.NET 4.x), Windows
Private Sub load_Image()
Dim imlTemp As New ImageList
Dim dirFiles() As String = IO.Directory.GetFiles("C:\IMGVB\")
Dim _imgList As New ImageList
Dim imgSize As New Size
imgSize.Width = 150
imgSize.Height = 150
ListView1.LargeImageList = _imgList
Dim count As Integer = 0
Dim item As New ListViewItem
For Each dirFile As String In dirFiles
For Each extension As String In allowedExtensions
If extension = IO.Path.GetExtension(dirFile) Then
Dim img As New System.Drawing.Bitmap(dirFile)
_imgList.ImageSize = imgSize
_imgList.Images.Add(img.Clone)
ListView1.Items.Add(dirFile, count)
count += 1
End If
Next
Next
End Sub