Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
having trouble to read image as input stream from database.

System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
Byte[] imgData = (Byte[])dr["Image"].ToString();

or

System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
Byte[] imgData = (Byte[])dr["Image"];

cant get process done through above statements

but
Byte[] imgData = (Byte[])cmd.ExecuteScaler();

works fine,,,,, but i was to be doing using multiple records using ExecuteReader()
Help me out to sort this issue
Posted
Comments
pradiprenushe 31-Oct-13 5:16am    
Does 'Image' is first column in your select statement?
raeeschaudhary 31-Oct-13 5:17am    
yeah i have auto ID and Image ,,
pradiprenushe 31-Oct-13 5:21am    
Is it like select id,image OR select image,id ? Can you post code how you are getting values in datareader?

1 solution

Refer this forum in detail where you can get your problem solved.
http://forums.asp.net/t/1824646.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900