Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,687 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,273 people online right now. Registration is fast and FREE... Join Now!




how to retrieve images from ms access and display it in datagridview d

 
Reply to this topicStart new topic

how to retrieve images from ms access and display it in datagridview d

shameera
post 6 Jun, 2008 - 01:29 AM
Post #1


New D.I.C Head

*
Joined: 5 May, 2008
Posts: 1

retrieving images from msaccess and displaying it in datagridview using vb.net wub.gif wub.gif
Private Sub fillgrid()
ds = New DataSet
dim msstream as
Dim i, j As Integer
' "select a.shr_foliono,shr_name,sum(no_of_shares) from shr_det a,shr_issue_det b"
cmd.CommandText = "SELECT a.shr_foliono, a.shr_name, Sum(b.no_of_shares) AS SumOfno_of_shares" & _
" FROM shr_det as a INNER JOIN shr_issue_det as b ON a.shr_foliono=b.shr_foliono" & _
" GROUP BY a.shr_foliono, a.shr_name"
adp = New OdbcDataAdapter(cmd)
adp.Fill(ds)
cmd.CommandText = "select photos from shr_det"
objreader = cmd.ExecuteReader()
i = 0
While objreader.Read()
Dim pict As Byte() = CType(objreader.Item(i), Byte())
Dim fs As FileStream
Dim str As String = Application.StartupPath + "\images\photos\exp.jpg"
If System.IO.File.Exists(str) Then
File.Delete(str)
End If
fs = New FileStream(str, FileMode.CreateNew)
For j = 78 To pict.Length - 78
fs.WriteByte(pict(j))
Next
DataGridView1.Rows.Add(Image.FromStream(fs))
'Me.DataGridView1.Rows.Add(<column1 value>, <column2 value>, bmp1, <column3 value>, <column4 value>)

i = i + 1
End While
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 6 Jun, 2008 - 08:38 AM
Post #2


D.I.C Addict

Group Icon
Joined: 25 Feb, 2008
Posts: 596



Thanked 22 times

Dream Kudos: 750
My Contributions


This should probably be posted in the VB forums
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:21AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month