This is a migrated thread and some comments may be shown as answers.

image not showing in binaryimage

0 Answers 64 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Edd
Top achievements
Rank 1
Edd asked on 22 Dec 2014, 11:01 PM
hi, please i am using the cold below to show a varbinary image in a binaryimage but its not showing. 

         <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("Front_Image") %>'
                            AutoAdjustImageControlSize="false" Height="355px" Width="700px" ToolTip="Front Image"
                            AlternateText='<%#Eval("Front_Image", "Photo of {0}") %>' >
              
         </telerik:RadBinaryImage>
 
       <asp:SqlDataSource ID="SqlDataSourceImage" runat="server" ConnectionString="<%$ ConnectionStrings:ChequeViewConnectionString %>" SelectCommand="SELECT Front_Image FROM [Transactions]">
 
</asp:SqlDataSource>


below is also the code used in saving the image
System.IO.FileStream fs = new System.IO.FileStream(filepath, System.IO.FileMode.Open);
byte[] imageAsBytes = new byte[fs.Length];
fs.Read(imageAsBytes, 0, imageAsBytes.Length);
fs.Close();
 
SqlConnection conn = new SqlConnection(strconnection);
conn.Open();
SqlCommand cmd = new SqlCommand("INSERT INTO Transactions(Front_Image) VALUES (@Front_Image)", conn);
cmd.Parameters.AddWithValue("@Front_Image", imageAsBytes);
cmd.ExecuteNonQuery();
conn.Close();
any help as to what is wrong.

thanks

No answers yet. Maybe you can help?

Tags
BinaryImage
Asked by
Edd
Top achievements
Rank 1
Share this question
or