binary img in radrotator

2 posts, 0 answers
  1. Growls
    Growls avatar
    17 posts
    Member since:
    Apr 2009

    Posted 16 Jul 2009 Link to this post

    any idea why the following throws a System.ArgumentException: Parameter is not valid.? basically, I have a grid, that when I click on the thumbnail, opens a radwindow which loads a page with the below code to generate a radrotator with a radbinary as an inner control. (first few lines are just retrieving the binary image data from the database, in this case sql server 2008, using the enterprise library.)
    if (!string.IsNullOrEmpty(Request.QueryString["productID"])) 
                { 
                    Database db = DatabaseFactory.CreateDatabase("sql"); 
                    DbCommand mycommand = db.GetSqlStringCommand("SELECT mediaID,imageFull FROM core.productMedia WHERE (productID = @productID AND active=1 AND removed=0)"); 
                    db.AddInParameter(mycommand, "productID", DbType.Int32, Request.QueryString["productID"]); 
                    DataTable mytable = db.ExecuteDataSet(mycommand).Tables[0]; 
                    Debug.WriteLine("number of media " + mytable.Rows.Count.ToString()); 
                    if (mytable.Rows.Count > 0) 
                    { 
                        RadRotator myrot = new RadRotator(); 
                         
     
                        foreach (DataRow myrow in mytable.Rows) 
                        { 
                            RadBinaryImage myimg = new RadBinaryImage(); 
                            myimg.DataValue = (byte[])myrow[1]; 
                            Debug.WriteLine("media " + myrow[0].ToString()); 
                            RadRotatorItem myitem = new RadRotatorItem(); 
                            myitem.Controls.Add(myimg); 
                            myrot.Items.Add(myitem); 
     
                        } 
                        Panel1.Controls.Add(myrot); 
                    } 
                } 

  2. Growls
    Growls avatar
    17 posts
    Member since:
    Apr 2009

    Posted 16 Jul 2009 Link to this post

    never mind this one, I determined that the image wasn't stored to the database correctly, as such the exception was thrown when trying to load.
Back to Top