Link to home
Start Free TrialLog in
Avatar of rcowen00
rcowen00Flag for United States of America

asked on

The 'StoreType' parameter is missing a value

I have a ssrs that run fine when I run it from the report project.  When I run it from the application, I am getting the error The 'StoreType' parameter is missing a value.   The StoreType parameter is not required and I set a default in the  code behind.  What am I missing?

code behind to run the report and push the parameters to the report viewer
 Protected Sub btnRun_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGetReport.Click
        Dim colRP As New System.Collections.Generic.List(Of Microsoft.Reporting.WebForms.ReportParameter)
        colRP.Add(New Microsoft.Reporting.WebForms.ReportParameter("Userid", Membership.GetUser(My.User.Name).ProviderUserKey.ToString()))
        If IsDate(txbgn.Text.Trim) Then
            Dim dteStart As Date = txbgn.Text.Trim
            colRP.Add(New Microsoft.Reporting.WebForms.ReportParameter("Begin", Right("0" & dteStart.Month, 2) & "/" & _
           Right("0" & dteStart.Day, 2) & "/" & dteStart.Year))
        End If
        If IsDate(txend.Text.Trim) Then
            Dim dteEnd As Date = txend.Text.Trim
            colRP.Add(New Microsoft.Reporting.WebForms.ReportParameter("End", Right("0" & dteEnd.Month, 2) & "/" & _
            Right("0" & dteEnd.Day, 2) & "/" & dteEnd.Year))
        End If
        If lbStoreType.Items.Count > 0 Then
            Dim stStoreType As New List(Of String)()
            For Each item As ListItem In lbStoreType.Items
                If item.Selected Then
                    stStoreType.Add(item.Value)
                End If
            Next
            colRP.Add(New Microsoft.Reporting.WebForms.ReportParameter("StoreType", stStoreType.ToArray()))
        Else
            Dim stStoreType As String = "-1"
            colRP.Add(New Microsoft.Reporting.WebForms.ReportParameter("StoreType", stStoreType))
        End If
        rv1.ServerReport.ReportServerUrl = New Uri("http://localhost:80/reportserver")
        rv1.ServerReport.ReportPath = "/POSReports/DepositReport"
        rv1.ServerReport.SetParameters(colRP)
        rv1.ServerReport.Refresh()
        rv1.Visible = True
    End Sub

Open in new window

Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

i had a similar problem with my application. I fixed it by (in SSMS):

IF OBJECTPROPERTY(object_id('dbo.spAddCustomerWithOneOrder'), N'IsProcedure') = 1
DROP PROCEDURE [dbo].spAddCustomerWithOneOrder

GO

CREATE PROCEDURE [dbo].[spAddCustomerWithOneOrder]
     @FirstName varchar(30)
    , @LastName varchar(30)
.
.

I originally had an output parameter. I removed it and ran Alter Procedure but for some reason it was not working for me. I hope this is also applicable in your case. Let me know.

Mike
Avatar of rcowen00

ASKER

I don't think the problem is with the stored procedure though.   The naming and case is correct, I think that the problem is my code behind not pushing the parameter correctly.  Or am I misunderstanding?  Thank you.
ASKER CERTIFIED SOLUTION
Avatar of rcowen00
rcowen00
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The expert did try to help, but the issue was not the same and I resolved on my own.