2007-01-22

將DB中的圖片讀到記憶體

Dim TheDS As New DataSet
        TheDS = TheDB.SelectRows("select * from Product_picture where PPID=" & ListExistPICID.Items.Item(ListExistPIC.SelectedIndex))
        Dim myRow As DataRow
        myRow = TheDS.Tables(0).Rows(0)
      
        Dim MyData() As Byte
        MyData = myRow("ThePicture")
        Dim bs As Stream = New MemoryStream()
        bs.Write(MyData, 0, MyData.Length)
        PB.Image = Image.FromStream(bs)
        bs = Nothing
        TheDS = Nothing

沒有留言:

張貼留言