2010-08-25 7 views
0

Я пытаюсь отобразить изображение из набора данных xsd в отчете о кристалле, но он не отображает изображение. Пожалуйста, помогите мне.кристалл отчет динамическое изображение не отображается

С уважением Riyaz

string sql = "select * from ImageUpload"; 
    SqlDataAdapter da = new SqlDataAdapter(sql, strConn); 
    DataSet ds = new DataSet(); 
    da.Fill(ds, "Image");  

    for (int index = 0; index < ds.Tables[0].Rows.Count; index++) 
    { 
     if (ds.Tables[0].Rows[index]["thumb_path"].ToString() != "") 
     { 
      //if (File.Exists(Server.MapPath("~/129204153594EFF/Image13.jpg") + 
      // ds.Tables[0].Rows[index]["thumb_path"].ToString())) 

      if (File.Exists(Server.MapPath("~/129204153594EFF/Image13.jpg"))) 
      { 
       LoadImage(ds.Tables[0].Rows[index], "image_stream", 
        Server.MapPath("~/129204153594EFF/Image13.jpg")); 
      } 
     } 
    } 

    // ReportDocument crReportDocument = BLL.BusinessLogicLayer.Globals.GetReportDocument("rport.rpt"); 

    ReportDocument crReportDocument = BLL.BusinessLogicLayer.Globals.GetReportDocument("rport.rpt"); 

    crReportDocument.SetDataSource(ds.Tables[0]); 
    CrystalReportViewer1.ReportSource = crReportDocument; 
} 

private void LoadImage(DataRow objDataRow, string strImageField, string FilePath) 
{ 
    try 
    { 
     FileStream fs = new FileStream(FilePath, System.IO.FileMode.Open, 
     System.IO.FileAccess.Read); 
     byte[] Image = new byte[fs.Length]; 
     fs.Read(Image, 0, Convert.ToInt32(fs.Length)); 
     fs.Close(); 
     objDataRow[strImageField] = Image; 
    } 
    catch (Exception ex) 
    { 
     //Handler 
    } 
} 

ответ

-1

добавить это с соответствующим маркером и версии для отчетов кристаллическими, и вы будете хорошо идти в файл web.config

Смежные вопросы