By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,101 Members | 1,463 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,101 IT Pros & Developers. It's quick & easy.

How to retriving the Image files from ACCESS 2003

P: n/a
Hi All ,

I've stored the Image file..... But i want to retriving the Image
files from MSACCSS 2003 (JPEG,bmp,Gif and etc....) So Pls help
me........ help me...............
Thanking you,
Somasundaram G

Feb 23 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Soma,

Have a look of this one, it handles the offset too from the old Access use.

http://www.vb-tips.com/dbpages.aspx?...d-253a1ec85fc3

Cor

<so**************@gmail.comschreef in bericht
news:11**********************@v33g2000cwv.googlegr oups.com...
Hi All ,

I've stored the Image file..... But i want to retriving the Image
files from MSACCSS 2003 (JPEG,bmp,Gif and etc....) So Pls help
me........ help me...............
Thanking you,
Somasundaram G

Feb 23 '07 #2

P: n/a
Hi,
still not getting the retrive the image FROM Access Database... i wrote the code...But iam getting these Error.... So pls Make it....

Unable to cast of type 'system.String'to type 'System.Byte[]'


Private Sub cmb_id_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmb_id.SelectedIndexChanged
Try
'Dim Emp_id As String = ""
MsgBox(cmb_id.SelectedItem)
con.Close()
con.Open()

cmd = New OleDbCommand("select * from emp_details_tab where emp_id=" & cmb_id.SelectedItem & "", con)
dr = cmd.ExecuteReader()
While dr.Read()

txt_name.Text = dr.GetValue(1) '("emp_name")
txt_address.Text = dr.GetValue(2) 's("emp_address")
MaskedTextBox1.Text = dr.GetValue(3) '("dob")
MaskedTextBox2.Text = dr.GetValue(4) '("doj")
txt_qualify.Text = dr.GetValue(5) '("Qualify")
txt_no_yrs_exp.Text = dr.GetValue(6) '("No_Of_Yrs")
txt_worked_exp.Text = dr.GetValue(7) '("Experinced_Details")
Dim retval As Long

Dim buffersize As Integer = 100
Dim outbyte(buffersize - 1) As Byte
Dim bw As BinaryWriter

Dim k As Long

Dim fs As New IO.FileStream("employ_Image", FileMode.OpenOrCreate, FileAccess.Write)
bw = New BinaryWriter(fs)
k = 0
retval = dr.GetBytes(1, k, outbyte, 0, buffersize)
Do While retval = buffersize
bw.Write(outbyte)
bw.Flush()
k += buffersize
retval = dr.GetBytes(1, k, outbyte, 0, buffersize)
Loop
bw.Write(outbyte, 0, retval - 1)

Emp_image.Image = Image.FromFile(filepath)

bw.Close()
fs.Close()

MsgBox("Image Retrived")
End While

Catch ex As Exception
MsgBox(ex.Message)
Finally
con.Close()
End Try
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Mar 1 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.