473,508 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrive an Image from database

Hi EveryBody:

I have the following code that I used in my application to retive image from
database:

Dim cnn As New SqlConnection("Data Source=localhost;Initial
Catalog=Husam;Integrated Security=True")
Dim cmd As SqlCommand
Dim sql As String
cnn.Open()
Sql = "SELECT Name,Picture FROM Pic"
cmd = New SqlCommand(sql, cnn)
Dim myReader As SqlDataReader = cmd.ExecuteReader()
While (myReader.Read())
byt = myReader.GetValue(1)
ms = New MemoryStream(byt)
End While
PictureBox1.Image = Image.FromStream(ms)
PictureBox1.ImageLocation = PictureBoxSizeMode.CenterImage
cnn.Close()

When I debug this project I got an error message that said:

Parameter is not valid and yellow line in
Pictuerbox1.image=image.fromstream(ms)

any help in this issue or any direction about how to retrive image from
database and disply it will be appreciated

regard's

Husam
Nov 5 '07 #1
1 1502
Husam,

This is a tip how to handle this.

It is using a reader from disk. There are a lot of samples using other
methods on our side. However this one is in my idea the best showing the
fundementals.

http://www.vb-tips.com/Image2ByteArray.aspx

Cor
Nov 5 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2522
by: asenthil | last post by:
Hai, i'm having a string in a specific field of a database... now i want to retrive that string from the database and i have to write that string into a xml file.... retriving is not a...
2
1651
by: soma.gunasekaran | last post by:
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,...
1
1460
by: rabik83 | last post by:
hai I store the image to the Mysql database its sucess so how can i get the IMAGE from the database please sent the code .........URGENT thanks
0
1597
nehashri
by: nehashri | last post by:
hi, I need one help regarding Asp with MsAccess database. Problem. ======== i want to retrive stored image from the MSAccess database using asp.
3
1700
by: mmr315 | last post by:
I wrote code like this to retrive images <?php mysql_connect("__MUNGED__","__MUNGED__","__MUNGED__")or die('unable'); mysql_select_db("website"); $pid="151"; $gotten =...
1
2970
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
3
2075
by: Eminosoft | last post by:
The below code can't take the images.plz tell that what is the problem in that code <?php // Connect to database $errmsg = ""; if (! @mysql_connect("localhost","root","sreeni")) { ...
1
1149
by: gopim | last post by:
hi i uploaded image to database table in binaryformat. but my problem is retrive that image(binaryformat) from database table to Gridview using C#.how can we done this could any one help regarding...
2
1348
by: chinnaits | last post by:
how to retrive image from the database
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.