这是我的代码:
Dim ds As New DataSet1
Dim cnn As SqlConnection
Dim con1 As String = "Data Source=;Initial Catalog=;Integrated Security=True"
Dim sql As String = "SELECT * FROM POBasket where POBNumber='" + txtorderno.Text + "'"
cnn = New SqlConnection(con1)
cnn.Open()
Dim dscmd As New SqlDataAdapter(sql, cnn)
Dim dscrystal As New DataSet1
dscmd.Fill(dscrystal, "POBasket")
cnn.Close()
Dim report As CrystalReport1 = New CrystalReport1
report.SetDataSource(dscrystal.Tables("POBasket"))
report.SetParameterValue("ProductName", "+")
poreport.pocrystalviewer.ReportSource = report
poreport.pocrystalviewer.Refresh()
poreport.Show()
我总是得到错误:
报告没有表格
请帮助我!
答案 0 :(得分:0)
使用以下代码:
report.database.table[0].setdatasource(dscrystal.Tables("POBasket"))
而不是
report.SetDataSource(dscrystal.Tables("POBasket"))
它为我工作。
我认为它会对你有所帮助。