关于C#从数据库空提出图片的问题(急!~~~~~~)
if(dstOther.Tables[0].Rows[0][7]   !=   System.DBNull.Value   ) 
 						{ 
 							this.ImageCount=(Byte[])dstOther.Tables[0].Rows[0][7];      
 							if(this.ImageCount!=null) 
 							{ 
 								System.IO.MemoryStream   Ms   =   new   MemoryStream(this.ImageCount);      
 								Ms.Write(this.ImageCount,0,this.ImageCount.Length);   
 								this.img=(Image)Image.FromStream(Ms);  								 
 								this.picR4.Image=this.img   ; 
 							} 
 						}     
 上面代码运行到 
 this.img=(Image)Image.FromStream(Ms); 
 时出错提示说使用了无效参数. 
------解决方案--------------------dstOther.Tables[0].Rows[0][7]存的数据可能不正确     
 ***************************************************************************** 
 欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)    
 最新版本:20070212   
 http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
------解决方案--------------------dstOther.Tables[0].Rows[0][7] 
 跟踪看看这个有没有数据
------解决方案--------------------如何读取保存在数据库中的图片显示在DataGrid中  
 在DataGrid中有一个模板列,里面放置了一个ImageButton控件,当然Image也可以。你首先必须绑定DataGrid才能在使用DataBinder.Eval(Container, "DataItem.BookGuid ")等 
 如下: 
  <asp:Image id=Imagebutton1 runat= "server " ImageUrl= ' <%#  "BookCover.aspx?ImageID= "+DataBinder.Eval(Container, "DataItem.BookGuid ")%>  '>  </asp:Image>    
 //这里是把图片的编号传到一个取图片的页面里,然后连接到图片上的,注意这里用的是ImageUrl,不是平常文本框用的text 
 BookCover.aspx页面   
 private void Page_Load(object sender, System.EventArgs e) 
   { 
    // 在此处放置用户代码以初始化页面 
    string str=System.Configuration.ConfigurationSettings.AppSettings[ "cn "];//得到Webconfig里的连接字符串 
    SqlConnection cn=new SqlConnection(str); 
    SqlCommand cmd=new SqlCommand(); 
    cmd.CommandText= "select Cover from Books where BookGuid= ' "+this.Request[ "ImageID "]+ " ' ";//取得数据库中的图片 
    cmd.Connection=cn; 
    cn.Open(); 
    this.Response.ContentType= "image/* ";//设置类型 
    SqlDataReader dr=cmd.ExecuteReader(); 
    while(dr.Read()) 
    { 
     this.Response.BinaryWrite((byte[])dr[ "Cover "]);//读取后转换为字节数组 
    } 
    cn.Close(); 
   }