vs2008 C# Winform中水晶報表載入圖片的問題
我使用的是vs2008內建的Crystal report
首先我先建立rpt檔案
接著建立.xsd檔案,利用ADO.NET的方式將.xsd做為rpt的資料格式
xsd顯示如下:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="XMLSchema1"
    targetNamespace="http://tempuri.org/XMLSchema1.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/XMLSchema1.xsd"
    xmlns:mstns="http://tempuri.org/XMLSchema1.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:element name="Document">
    <xs:complexType>
      <xs:choice maxOccurs="unbounded">
        <xs:element name="packinglist">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="P2" type="xs:string" minOccurs="0" />
              <xs:element name="P3" type="xs:base64Binary" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>
接著在.cs檔中載入圖片
部分程式碼如下:
     ds.Tables.Add();
     ds.Tables[0].Columns.Add("P3", System.Type.GetType("System.Byte[]"));
     ds.Tables[0].Columns.Add("P2", System.Type.GetType("System.String"));
     ds.Tables[0].AcceptChanges();
     ds.AcceptChanges();
     FileStream fLogo = new FileStream(g_sPath + @"\barcode.png", FileMode.Open, FileAccess.Read);
     BinaryReader bReader = new BinaryReader(fLogo);
     byte[] bt = bReader.ReadBytes(Convert.ToInt32(bReader.BaseStream.Length));
     if (ds.Tables[0].Rows.Count <= 0)
     {
         DataRow dr = ds.Tables[0].NewRow();
         ds.Tables[0].Rows.Add(dr);
         ds.Tables[0].AcceptChanges();
         ds.AcceptChanges();
      }
      ds.Tables[0].Rows[0]["P3"] = bt;
      ds.Tables[0].Rows[0]["P2"] = "ABC";
      ds.AcceptChanges();
      fLogo.Close();
      doc.SetDataSource(ds.Tables[0]);
      crystalReportViewer1.ReportSource = doc;
最後將資料型態為base64Binary的"P3"拉近rpt檔中,
顯示出來的圖片只有框線,中間是空白的,
另外我從oracle中讀取BLOB資料型態的資料,丟給rpt,所顯示出來的圖片也是空白的,但字串、數字等皆可正常顯示
想請問各位高手是否有好的解決方案。
------解决方案--------------------