我試圖在Crystal Reports中創建報告,但是當我將參數分配給報告時,它不顯示選擇查詢的結果。它顯示錶格的所有列,儘管選擇查詢的結果是正確的。這是我的代碼:Crystal Reports,Visual Basic 2010和mysql報告
Dim ulogueado, consulta As String
consulta = "select nombre from usuario where usuario = @user"
Dim lector1 As MySqlDataReader
Dim comando As New MySqlCommand(consulta, conector)
comando.Parameters.AddWithValue("@user", usuario_conectado)
Try
lector1 = comando.ExecuteReader()
If lector1.Read Then
ulogueado = lector1.GetString(0)
End If
Dim reporte1 As New CrystalReport3
reporte1.SetDataSource(lector1.GetString(0))
reportes1.CrystalReportViewer1.ReportSource = reporte1
reportes1.CrystalReportViewer1.RefreshReport()
Catch ex As Exception
End Try
reportes1.Show()
我幾乎可以肯定問題可能在SetDataSource行,但我不知道我還能做什麼。我很感謝你對這個問題的關注和合作。
你有沒有檢查http://stackoverflow.com/questions/8676448/my-crystal-report-is-not-getting-refreshed-while-passing-parameter – haraman