I'm trying to create a report in Crystal Reports, but when I assign the parameters to the report, it doesn't show the result from the select query. It shows all columns of the table, although the result of the select query is correct. This is my code:
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()
I'm almost sure that the problem could be in SetDataSource line, but I don't know what else can I do. I appreciate all your attention and collaboration with this issue.