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

binary img in radrotator

1 Answer 117 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Growls
Top achievements
Rank 1
Growls asked on 17 Jul 2009, 01:22 AM
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); 
                } 
            } 

1 Answer, 1 is accepted

Sort by
0
Growls
Top achievements
Rank 1
answered on 17 Jul 2009, 04:41 AM
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.
Tags
BinaryImage
Asked by
Growls
Top achievements
Rank 1
Answers by
Growls
Top achievements
Rank 1
Share this question
or