User-1542511547 posted
I have the attached code. If I run the report with single parameter (and comment out the two multiple parameter rows), the report runs great.
If I reverse (comment out single and uncomment multiple), the report fails with an error Object must implement IConvertible and highlights the row Search(0) = New SqlParameter("@loc", cboLoc.text)
Been reading a little about the error and it appears that it may be that I need to designate the type of parameter to SQL. Can I designate the SQL type in this code or do I need to re-write it another way?
Protected Sub cmdRun_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRun.Click
rvmySample.Visible = True
Dim thisConnection As New SqlConnection(thisConnectionString)
Dim thisDataSet As New System.Data.DataSet()
'******************************************************************************************************
'*****Single Parameter
'thisDataSet = SqlHelper.ExecuteDataset(thisConnection, "spAvgDailyPatients", cboLoc.Text)
'*****Multiple Parameter
SearchValue(0) = New SqlParameter("@Loc", cboLoc.Text)
thisDataSet = SqlHelper.ExecuteDataset(thisConnection, "spAvgDailyPatients", SearchValue)
'******************************************************************************************************
Dim datasource As New ReportDataSource("qryAvgDailyPat_rptAvgDailyPatients", thisDataSet.Tables(0))
rvmySample.LocalReport.DataSources.Clear()
rvmySample.LocalReport.DataSources.Add(datasource)
If thisDataSet.Tables(0).Rows.Count = 0 Then
lblMessage.Text = "Sorry, no locations available!"
End If
rvmySample.LocalReport.Refresh()
End Sub