2个sql查询1个报告源vb.net

时间:2016-08-03 10:02:33

标签: sql vb.net crystal-reports odbc

如何为1个报告源提供2个sql查询?我尝试使用此代码,但发现显示两个表,没有显示的数据。

    soa.Show()
    Dim objcr As New receipt


    Dim conn As New System.Data.Odbc.OdbcConnection
    conn.ConnectionString = "Driver={" + var.driver + "};server=" + var.server + ";database=" + var.database + ";uid=" + var.uid + ";password=" + var.password + "; port=" + var.port + ""
    conn.Open()
    Dim da As New System.Data.Odbc.OdbcDataAdapter("select * from lguset", conn)
    Dim dt As New DataTable
    Dim da1 As New System.Data.Odbc.OdbcDataAdapter("select * from land where landID = '17'", conn)
    Dim dt1 As New DataTable
    da.Fill(dt)
    da1.Fill(dt1)
    Dim ds As New DataSet
    ds.Tables.Add(dt)
    ds.Tables.Add(dt1)


    objcr.SetDataSource(ds)

    soa.CrystalReportViewer1.ReportSource = objcr
    soa.CrystalReportViewer1.RefreshReport()

0 个答案:

没有答案