Parameter is missing a value

I have a report parameter with Allow null value checked (and also Allow blank value). The report works as expected when viewed in Visual Studio, i.e. if I don't supply a value for the parameter, the report still renders. However, when I try to view this report through the web ReportViewer I get the error message "The X parameter is missing a value". It works fine when a value is supplied but I want that parameter to be optional.

Any idea what's going wrong here

Thanks.



Answer this question

Parameter is missing a value

  • kbinhyd

    I didn't realize you were using the viewer sample. Since you are using SQL 2005, have you considered using the ReportViewer control that ships with Visual Studio 2005 It provides a lot more functionality than the sample and offers much better integration with your application.

    You can get a lot of good information on the control from www.gotreportviewer.com.


  • ZEugene

    This is the parameter:

    <ReportParameter Name="Group1">

    <DataType>String</DataType>

    <Nullable>true</Nullable>

    <AllowBlank>true</AllowBlank>

    <Prompt>Group1</Prompt>

    </ReportParameter>

    In VS, Null is selected as the default value.

    In the code that sets up the ReportViewer, I've tried both excluding the SetQueryParameter call for that parameter and also passing an empty string and both result in that error message.


  • scott859

    Yeah, I'm in the process of converting the code to that new control and it seems to get rid of this problem.

    Thanks.


  • rgb15

    Microsoft.Samples.ReportingServices.ReportViewer rv = new Microsoft.Samples.ReportingServices.ReportViewer();

    rv.ServerUrl = "http://localhost/ReportServer$SQL2005";

    rv.ReportPath = "GroupedReport";

    rv.Width = Unit.Percentage(100);

    rv.Height = Unit.Percentage(100);

    rv.Parameters = Microsoft.Samples.ReportingServices.ReportViewer.multiState.False;

    //several parameters are added via

    rv.SetQueryParameter("ParamName", ParamValue);

    Then for this particular parameter, I've tried just leaving out the set parameter call and also tried doing this:

    rv.SetQueryParameter("Group1", "");

    and

    rv.SetQueryParameter("Group1", null);

    Neither of which worked.

    And then of course:

    plhReport.Controls.Add(rv);

    Thanks for your help.


  • Kevmano1

    This all looks ok. Will you post your code that sets the report definition and any other parameters
  • Prashant jain

    Please help guys i posted in this forum yesterday and no one has replied. I cant even seem to get my report woking at all

    My form is very simple at the moment and has a drop down list that when a service is selected fires of a postback!

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">

    <title>Untitled Page</title>

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

    <cc1:Combobox ID="Combobox1" runat="server" CSSOptionIcon="ico" AutoPostbackEnable="true"

    FolderStyle="./combobox/styles/blueGray" Height="500" InnerWidth="500" Width="500">

    </cc1:Combobox>

    </div>

    <div>

    <rsweb:ReportViewer ID="SRViewer" runat="server" Visible="false" Height="600px" Width="600px" Font-Names="Verdana" Font-Size="8pt">

    </rsweb:ReportViewer>

    </div>

    </form>

    </body>

    </html>

    when fired the form databinds the report to a dataset / table that is returned based on drop down selection and year. for now i phisivcally put in '2007'

    Protected Sub SRViewer_DataBinding(ByVal sender As Object, ByVal e As EventArgs) Handles SRViewer.DataBinding

    Dim dt As DataTable = New DataTable

    dt = ServiceReport(Combobox1.Text, "2007").Tables(0)

    Dim DR As DataColumnCollection = dt.Columns

    Dim FD As DataColumn = dt.Columns("No_of_Complaints")

    Dim tD As DataColumn = dt.Columns("MonthName")

    Dim bindDs_name As String = "dt"

    Dim reportName As String = "Service Report"

    Dim reportPath As String = "Report1.rdlc"

    Dim fullReportPath As String = reportPath + reportName

    Dim txtReportTitle As String = "Service Report"

    If Session("fullReport") Is Nothing Then

    Session.Add("fullReport", reportPath + reportName)

    Else

    Session.Remove("fullReport")

    Session.Add("fullReport", reportPath + reportName)

    End If

    SRViewer.LocalReport.DisplayName = "Service Report"

    SRViewer.LocalReport.ReportPath = "Report1.rdlc"

    Dim No_of_Complaints As ReportParameter = New ReportParameter

    Dim Month_Name As ReportParameter = New ReportParameter

    No_of_Complaints.Name = "No_of_Complaints"

    Month_Name.Name = "Month_Name"

    For Each FD In DR

    No_of_Complaints.Values.Add(FD.ToString())

    Month_Name.Values.Add(tD.ToString())

    Next

    Dim myReportParams As ReportParameter() = New ReportParameter() {No_of_Complaints, Month_Name}

    SRViewer.LocalReport.SetParameters(myReportParams)

    If Not (dt Is Nothing) Then

    SRViewer.LocalReport.DataSources.Clear()

    SRViewer.LocalReport.DataSources.Add(New ReportDataSource(bindDs_name.Trim, dt))

    dt.Dispose()

    End If

    End Sub

    my report viewer wouldnt even compile without me addind a dataset and some parameters to it!! I dunno why i even need these parameters i've downloaded numerous examples and cant actually ubderstand the logic behind this particuar control...

    < xml version="1.0" encoding="utf-8" >

    <xs:schema id="dt" targetNamespace="http://tempuri.org/dt.xsd" xmlns:mstns="http://tempuri.org/dt.xsd" xmlns="http://tempuri.org/dt.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">

    <xs:annotation>

    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">

    <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">

    <Connections>

    <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="connString" ConnectionStringObject="" IsAppSettingsProperty="True" Modifier="Assembly" Name="connString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.connString.ConnectionString" Provider="System.Data.SqlClient">

    </Connection>

    </Connections>

    <Tables>

    <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="SelectServiceReportTableAdapter" GeneratorDataComponentClassName="SelectServiceReportTableAdapter" Name="SelectServiceReport" UserDataComponentName="SelectServiceReportTableAdapter">

    <MainSource>

    <DbSource ConnectionRef="connString (Web.config)" DbObjectName="TestComplaints.TestComplaint.SelectServiceReport" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="False" GeneratorGetMethodName="GetServiceData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetServiceData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetServiceData" UserSourceName="Fill">

    <SelectCommand>

    <DbCommand CommandType="StoredProcedure" ModifiedByUser="False">

    <CommandText>TestComplaint.SelectServiceReport</CommandText>

    <Parameters>

    <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="dt" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="False" SourceVersion="Current">

    </Parameter>

    </Parameters>

    </DbCommand>

    </SelectCommand>

    </DbSource>

    </MainSource>

    <Mappings>

    <Mapping SourceColumn="Total" DataSetColumn="Total" />

    <Mapping SourceColumn="MonthName" DataSetColumn="MonthName" />

    </Mappings>

    <Sources>

    </Sources>

    </TableAdapter>

    </Tables>

    <Sources>

    </Sources>

    </DataSource>

    </xs:appinfo>

    </xs:annotation>

    <xs:element name="dt" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="dt" msprop:Generator_DataSetName="_dt">

    <xs:complexType>

    <xs:choice minOccurs="0" maxOccurs="unbounded">

    <xs:element name="dt" msprop:Generator_UserTableName="dt" msprop:Generator_RowDeletedName="dtRowDeleted" msprop:Generator_TableClassName="dtDataTable" msprop:Generator_RowChangedName="dtRowChanged" msprop:Generator_RowClassName="dtRow" msprop:Generator_RowChangingName="dtRowChanging" msprop:Generator_RowEvArgName="dtRowChangeEvent" msprop:Generator_RowEvHandlerName="dtRowChangeEventHandler" msprop:Generator_TablePropName="dt" msprop:Generator_TableVarName="tabledt" msprop:Generator_RowDeletingName="dtRowDeleting">

    <xs:complexType>

    <xs:sequence>

    <xs:element name="Total" msprop:Generator_UserColumnName="Total" msprop:Generator_ColumnPropNameInRow="Total" msprop:Generator_ColumnVarNameInTable="columnTotal" msprop:Generator_ColumnPropNameInTable="TotalColumn" type="xs:string" minOccurs="0" />

    <xs:element name="MonthName" msprop:Generator_UserColumnName="MonthName" msprop:Generator_ColumnPropNameInRow="MonthName" msprop:Generator_ColumnVarNameInTable="columnMonthName" msprop:Generator_ColumnPropNameInTable="MonthNameColumn" type="xs:string" minOccurs="0" />

    </xs:sequence>

    </xs:complexType>

    </xs:element>

    <xs:element name="SelectServiceReport" msprop:Generator_UserTableName="SelectServiceReport" msprop:Generator_RowDeletedName="SelectServiceReportRowDeleted" msprop:Generator_TableClassName="SelectServiceReportDataTable" msprop:Generator_RowChangedName="SelectServiceReportRowChanged" msprop:Generator_RowClassName="SelectServiceReportRow" msprop:Generator_RowChangingName="SelectServiceReportRowChanging" msprop:Generator_RowEvArgName="SelectServiceReportRowChangeEvent" msprop:Generator_RowEvHandlerName="SelectServiceReportRowChangeEventHandler" msprop:Generator_TablePropName="SelectServiceReport" msprop:Generator_TableVarName="tableSelectServiceReport" msprop:Generator_RowDeletingName="SelectServiceReportRowDeleting">

    <xs:complexType>

    <xs:sequence>

    <xs:element name="Total" msdata:ReadOnly="true" msprop:Generator_UserColumnName="Total" msprop:Generator_ColumnPropNameInRow="Total" msprop:Generator_ColumnVarNameInTable="columnTotal" msprop:Generator_ColumnPropNameInTable="TotalColumn" type="xs:int" minOccurs="0" />

    <xs:element name="MonthName" msdata:ReadOnly="true" msprop:Generator_UserColumnName="MonthName" msprop:Generator_ColumnPropNameInRow="MonthName" msprop:Generator_ColumnVarNameInTable="columnMonthName" msprop:Generator_ColumnPropNameInTable="MonthNameColumn" minOccurs="0">

    <xs:simpleType>

    <xs:restriction base="xs:string">

    <xs:maxLength value="30" />

    </xs:restriction>

    </xs:simpleType>

    </xs:element>

    </xs:sequence>

    </xs:complexType>

    </xs:element>

    </xs:choice>

    </xs:complexType>

    </xs:element>

    </xs:schema>

    I have no clue why i should use this dataset The data i need comes from

    Public Function ServiceReport(ByVal Service As String, ByVal Year As String) As DataSet

    Dim SR As New DataSet

    Dim db As New Database

    Try

    db.CommandText = "SELECT sum([Total])as No_of_Complaints,[MonthName]" & _

    "FROM [TestComplaints].[dbo].[servicereport]" & _

    "where [Service] = '" + Service + "' and DatePart(yy, [ReceivedDate]) = '" + Year + "'" & _

    "GROUP By [MonthName]"

    SR = db.ReturnDataSet(conn)

    Catch ex As Exception

    Throw ex

    End Try

    Return SR

    End Function

    where i have classes like database in my project that return tables etc.

    when i run this in sql all i retrieve is what i want to present in the 3D type charts..

    5 April
    2 August
    3 December
    4 February
    7 January
    3 July
    6 June
    5 March
    10 May
    1 November
    6 October

    my x-m axis showing the months and y axis the total value..

    I wont probably hear from anyone but thought to post anyways.


  • Mark Melburn

    All parameters must have a value. In your case, it sounds like you want the default value to be null (or maybe empty string). Have you specified this as the default value Can you post a sample RDL


  • Parameter is missing a value