返回首页

您好所有,

我有一个数据集与数据表"Load_image","Load_Word"。我想设置它们作为数据源的水晶报表和数据不传递到各自的领域。

当我路过只有一个DataTable,数据填充水晶报表。我包括代码。

Public Sub Preview_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim cryRpt As New PreviewReport

        Dim sample As New DataSet

        Dim FS As FileStream

        Dim DTImage As New DataTable("Load_Image")

        Dim DTText As New DataTable("Load_Word")

        Dim IRow As DataRow

        DTImage.Columns.Add("HeaderImage", System.Type.GetType("System.Byte[]"))

        IRow = DTImage.NewRow

        Dim IR As BinaryReader

        cryRpt.Load("F:\Projects\2008 Projects\VB.NET\Print from wordpad\Print from wordpad\PreviewReport2.rpt")

        FS = New FileStream(Load_MS_Word.getfilepath, FileMode.Open)

        IR = New BinaryReader(FS)

        Dim imgbyte(FS.Length) As Byte

        imgbyte = IR.ReadBytes(Convert.ToInt32((FS.Length)))

        IRow(0) = imgbyte

        DTImage.Rows.Add(IRow)

        sample.Clear()

        sample.Tables.Add(DTImage)

        sample.Tables.Add(DTText)

        IR.Close()

        FS.Close()

        DTText.Columns.Add("RTFText", GetType(String))

        DTText.Rows.Add(Picture)

        cryRpt.SetDataSource(sample)

        CrystalReportViewer1.ReportSource = cryRpt

        CrystalReportViewer1.Refresh()

    End Sub

已经在水晶报表从表的"Load_image"和"Load_word"列。

在此,请帮助我。

回答

评论会员: 时间:2