http://expert.csdn.net/Expert/topic/1635/1635461.xml?temp=.5714685http://expert.csdn.net/Expert/topic/1275/1275901.xml?temp=.6623651

解决方案 »

  1.   

    ID Integer 主键ID 
    IMGTITLE Varchar(50) 图片的标题 
    IMGTYPE Varchar(50) 图片类型. ASP.NET要以辨认的类型 
    IMGDATA Image 用于存储二进制数据 从数据库中恢复读取
      现在让我们来从SQL Server中读取我们放入的数据吧!我们将要输出图片到你的浏览器上,你也可以将它存放到你要的位置。
    private void Page_Load(object sender, System.EventArgs e)
    {
     string imgid =Request.QueryString["imgid"];
     string connstr=((NameValueCollection)
     Context.GetConfig("appSettings"))["connstr"];
     string sql="SELECT imgdata, imgtype FROM ImageStore WHERE id = " + imgid;
     SqlConnection connection = new SqlConnection(connstr);
     SqlCommand command = new SqlCommand(sql, connection);
     connection.Open();
     SqlDataReader dr = command.ExecuteReader();
     if(dr.Read())
     {
      Response.ContentType = dr["imgtype"].ToString();
      Response.BinaryWrite( (byte[]) dr["imgdata"] );
     }
     connection.Close();
    } 要注意的是Response.BinaryWrite 而不是Response.Write.
      

  2.   

    最主要一句:Response.BinaryWrite不过,你如想控制大小,不妨看看我前面贴的地址.
      

  3.   

    asp.net(C#),数据库为oracle8i
    实现图片在datalist中显示,前面的我都试过了,好像不行!
    还有没有高手可以帮忙呀?
    望不吝赐教!