Friday, March 30, 2012

Report parameter 'x' was not found.

I created a simple report to display the default value of a report parameter.
But when I run in VS it works, but when I run it under the "Custom Report"
in SQL Server Managment Studio the report parameter is not found. Below is
the code what am I doing wrong. Thanks in advance for your help.
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"
xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="DataSource1">
<DataSourceReference>DataSource1</DataSourceReference>
<rd:DataSourceID>b64e9e97-e752-4d30-8e40-ad77c2582190</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>1in</BottomMargin>
<RightMargin>1in</RightMargin>
<ReportParameters>
<ReportParameter Name="x">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>5</Value>
</Values>
</DefaultValue>
<Prompt>x</Prompt>
</ReportParameter>
</ReportParameters>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ReportItems>
<Textbox Name="textbox1">
<Left>2in</Left>
<Top>0.375in</Top>
<rd:DefaultName>textbox1</rd:DefaultName>
<Width>1.125in</Width>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Height>0.375in</Height>
<Value>=First(Fields!x.Value, "DataSet1")</Value>
</Textbox>
</ReportItems>
<Height>2in</Height>
</Body>
<rd:ReportID>397ab84d-5c20-454f-9ec1-a1548611ba69</rd:ReportID>
<LeftMargin>1in</LeftMargin>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
<CommandText>select @.x x</CommandText>
<QueryParameters>
<QueryParameter Name="@.x">
<Value>=Parameters!x.Value</Value>
</QueryParameter>
</QueryParameters>
<DataSourceName>DataSource1</DataSourceName>
</Query>
<Fields>
<Field Name="x">
<rd:TypeName>System.Object</rd:TypeName>
<DataField>x</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>6.5in</Width>
<InteractiveHeight>11in</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>Did you find a solution to this?
--
-sam
"Greg Larsen" wrote:
> I created a simple report to display the default value of a report parameter.
> But when I run in VS it works, but when I run it under the "Custom Report"
> in SQL Server Managment Studio the report parameter is not found. Below is
> the code what am I doing wrong. Thanks in advance for your help.
> <?xml version="1.0" encoding="utf-8"?>
> <Report
> xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition"
> xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
> <DataSources>
> <DataSource Name="DataSource1">
> <DataSourceReference>DataSource1</DataSourceReference>
> <rd:DataSourceID>b64e9e97-e752-4d30-8e40-ad77c2582190</rd:DataSourceID>
> </DataSource>
> </DataSources>
> <BottomMargin>1in</BottomMargin>
> <RightMargin>1in</RightMargin>
> <ReportParameters>
> <ReportParameter Name="x">
> <DataType>String</DataType>
> <DefaultValue>
> <Values>
> <Value>5</Value>
> </Values>
> </DefaultValue>
> <Prompt>x</Prompt>
> </ReportParameter>
> </ReportParameters>
> <rd:DrawGrid>true</rd:DrawGrid>
> <InteractiveWidth>8.5in</InteractiveWidth>
> <rd:SnapToGrid>true</rd:SnapToGrid>
> <Body>
> <ReportItems>
> <Textbox Name="textbox1">
> <Left>2in</Left>
> <Top>0.375in</Top>
> <rd:DefaultName>textbox1</rd:DefaultName>
> <Width>1.125in</Width>
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingRight>2pt</PaddingRight>
> <PaddingTop>2pt</PaddingTop>
> </Style>
> <CanGrow>true</CanGrow>
> <Height>0.375in</Height>
> <Value>=First(Fields!x.Value, "DataSet1")</Value>
> </Textbox>
> </ReportItems>
> <Height>2in</Height>
> </Body>
> <rd:ReportID>397ab84d-5c20-454f-9ec1-a1548611ba69</rd:ReportID>
> <LeftMargin>1in</LeftMargin>
> <DataSets>
> <DataSet Name="DataSet1">
> <Query>
> <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
> <CommandText>select @.x x</CommandText>
> <QueryParameters>
> <QueryParameter Name="@.x">
> <Value>=Parameters!x.Value</Value>
> </QueryParameter>
> </QueryParameters>
> <DataSourceName>DataSource1</DataSourceName>
> </Query>
> <Fields>
> <Field Name="x">
> <rd:TypeName>System.Object</rd:TypeName>
> <DataField>x</DataField>
> </Field>
> </Fields>
> </DataSet>
> </DataSets>
> <Width>6.5in</Width>
> <InteractiveHeight>11in</InteractiveHeight>
> <Language>en-US</Language>
> <TopMargin>1in</TopMargin>
> </Report>

No comments:

Post a Comment