Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2004, 01:25 AM
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to retreive an image from database

i want to retrieive the photo of employees stored in table employees

of Northeind database.
I have 4 buttons(First,Next,Previous,Last) and one PictureBox on the

form.
Coding of the Last button is as follows:

 Dim bm As BindingManagerBase
      bm = Me.BindingContext(DsEmployees1, "employees")
      bm.Position = bm.Count - 1
      Dim c As Integer = DsEmployees1.Tables("employees").Rows.Count
 Dim ctr As Integer = DsEmployees1.Tables(0).Rows.Count - 1

Dim bytEmpPhoto() As Byte =

DsEmployees1.Tables("employees").Rows(ctr)("Photo" )
      Dim stmEmpPhoto As New MemoryStream(bytEmpPhoto)
      PictureBox1.Image = Image.FromStream(stmEmpPhoto)

This coding gives me an error:
'System.ArgumentException' occured.
Error: Invalid Parameter Used.

lovely
 
Old October 9th, 2004, 11:39 AM
Friend of Wrox
 
Join Date: Feb 2004
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Go to this link for more information

http://support.microsoft.com/default...b;EN-US;317701



It is not how much we do,
but how much love we put in the doing.

-Mother Theresa
 
Old October 18th, 2004, 05:43 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have a look at the following link for code that shows how to insert and retrieve images into a database. The example code is for Access, but it should work for SQL Server if you just change the connection string.

http://www.databasefaq.thefreeserver.com/#q13






Similar Threads
Thread Thread Starter Forum Replies Last Post
set image on <asp:Image> stored in DataBase myself.panku ASP.NET 2.0 Professional 1 August 11th, 2008 10:41 AM
retreive data from database eugz Beginning PHP 2 February 15th, 2006 08:45 PM
Upload image to database or not to database? thachnn SQL Server ASP 0 October 11th, 2004 03:00 AM
Retreive records from the database using SP sri20040 Classic ASP Databases 1 October 6th, 2004 05:36 PM
Can not retreive data from database eliea ASP.NET 1.0 and 1.1 Basics 3 July 24th, 2003 04:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.