Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
Hello sir,
I am trying to simply retrieve the image from the database. but it will show an error in the below code that parameters is not valid. please provide any solution...


public partial class Register_Presentation_ar : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

         DataTable dt= getImagesName();
         byte[] barrImg = (byte[])dt.Rows[0]["Images"];
         MemoryStream mstream = new MemoryStream(barrImg);
        Repeater1.DataSource="mstream";
        Repeater1.DataBind();
        
        
    }

    public DataTable getImagesName()
    {
        connection con = new connection();
        con.getconnectionstring();
        SqlCommand sqlcmd;
        sqlcmd = new SqlCommand("getImageName", connection.con);
        sqlcmd.CommandType = CommandType.StoredProcedure;
        DataTable ds = new DataTable();
        SqlDataAdapter da = new SqlDataAdapter(sqlcmd);
        da.Fill(ds);
        return ds;
      
       
      
    }
}
Posted
Comments
Aatif Ali from Bangalore 4-Jul-13 4:48am    
<img src='/images/<%# DataBinder.Eval(Container.DataItem, "Image") %>'
alt="" style="height:200px;width:200px;border:1px solid gray;"/>

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