如何通过SQL查询字符串从数据库向Crystal Reports生成多个图像?

时间:2019-05-21 09:39:13

标签: vb.net crystal-reports crystal-reports-2016

如何在Visual Basic .net中通过SQL查询字符串从数据库向Crystal Reports生成多个图像

我的代码:

Dim strcon As String = Form2.strcon
Dim connection As New SqlConnection(strcon)
Dim da As New SqlDataAdapter

Private Sub Form11_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    Dim ds1 As New DataSet1
    Dim sql As String

    connection.Open()
    sql = "Select no, name, pic from tmp_data"
    da = New SqlDataAdapter(sql, connection)
    da.Fill(ds1, "warranty")
    MsgBox(ds1.Tables(1).Rows.Count)
    connection.Close()

    Dim objRpt As New u1report 'this is my crystal report
    objRpt.SetDataSource(ds1.Tables(1))
    CrystalReportViewer1.ReportSource = objRpt
    CrystalReportViewer1.Refresh()

End Sub

我的桌子:

no           name       pic
2430868      22T        22T-SL1904185507.jpg
2430869      22T        22T-SL1904185508.jpg
2430870      22T        22T-SL1904185509.jpg
2430871      22T        22T-SL1904185510.jpg
2430872      22T        22T-SL1904185511.jpg

我可以显示此信息,但不知道如何通过编码显示图片。 我可以做吗?怎么样?谢谢您的帮助。

0 个答案:

没有答案