4,816
社区成员




<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="testDb" targetNamespace="http://tempuri.org/datatest.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/datatest.xsd" xmlns:mstns="http://tempuri.org/datatest.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="text">
<xs:complexType>
<xs:sequence>
<xs:element name="imagetest" type="xs:base64Binary" minOccurs="0" />
<xs:element name="test" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
protected void Page_Load(object sender, EventArgs e)
{
FileStream fs1 = new FileStream(@"C:\zyg.gif", FileMode.Open, FileAccess.Read);
BinaryReader br1 = new BinaryReader(fs1);
br1.ReadBytes((int)fs1.Length);
DataSet ds = new DataSet();
ds.Tables.Add("testDb");
ds.Tables[0].Columns.Add("imagetest", System.Type.GetType("System.Byte[]"));
ds.Tables[0].Columns.Add("test", System.Type.GetType("System.String"));
ds.Tables[0].Rows.Add();
ds.Tables[0].Rows[0]["imagetest"] = br1.ReadBytes((int)fs1.Length);
ds.Tables[0].Rows[0]["test"] = "zygsdasdasdaasdasd";
string reportPath = Server.MapPath("CrystalReport1.rpt");
CrystalReportSource1.ReportDocument.Load(reportPath);
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
fs1.Close();
}