image not showing in binaryimage

1 posts, 0 answers
  1. Edd
    Edd avatar
    37 posts
    Member since:
    Jan 2013

    Posted 22 Dec 2014 Link to this post

    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}") %>' >
           <asp:SqlDataSource ID="SqlDataSourceImage" runat="server" ConnectionString="<%$ ConnectionStrings:ChequeViewConnectionString %>" SelectCommand="SELECT Front_Image FROM [Transactions]">

    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);
    SqlConnection conn = new SqlConnection(strconnection);
    SqlCommand cmd = new SqlCommand("INSERT INTO Transactions(Front_Image) VALUES (@Front_Image)", conn);
    cmd.Parameters.AddWithValue("@Front_Image", imageAsBytes);
    any help as to what is wrong.

Back to Top