Reportviewer not showing any data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gandhi.vishal@gmail.com

    Reportviewer not showing any data

    Hello,
    I have an issue. I'm not seeing the reportviewer data at all. The
    column names come up fine but there is no data in the report table.
    Here is what I'm doing

    I created a dataset with the following query
    select * from av_project_mst where apm_project_id= @projectid

    Now I created a report (.rdlc) and dragged a table onto it and the
    report looks like the following

    <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns="http://schemas.microso ft.com/sqlserver/reporting/
    2005/01/reportdefinitio n" xmlns:rd="http://schemas.microso ft.com/
    SQLServer/reporting/reportdesigner" >
    <DataSources>
    <DataSource Name="test1">
    <rd:DataSourceI D>0ac0f7f1-9a46-4289-a79d-97cab9205b09</
    rd:DataSourceID >
    <ConnectionProp erties>
    <DataProvider>S QL</DataProvider>
    <ConnectStrin g />
    </ConnectionPrope rties>
    </DataSource>
    </DataSources>
    <InteractiveHei ght>11in</InteractiveHeig ht>
    <ReportParamete rs>
    <ReportParamete r Name="projectid ">
    <DataType>Strin g</DataType>
    <DefaultValue >
    <Values>
    <Value />
    </Values>
    </DefaultValue>
    <AllowBlank>tru e</AllowBlank>
    <Prompt>Report_ Parameter_0</Prompt>
    </ReportParameter >
    </ReportParameter s>
    <rd:DrawGrid>tr ue</rd:DrawGrid>
    <InteractiveWid th>8.5in</InteractiveWidt h>
    <rd:SnapToGrid> true</rd:SnapToGrid>
    <RightMargin>1i n</RightMargin>
    <LeftMargin>1in </LeftMargin>
    <BottomMargin>1 in</BottomMargin>
    <rd:ReportID>4b 5ab029-97b6-4439-966e-4a51232b81d2</rd:ReportID>
    <DataSets>
    <DataSet Name="DataSet1_ AV_PROJECT_MST1 ">
    <Fields>
    <Field Name="APM_Proje ct_Name">
    <DataField>APM_ Project_Name</DataField>
    <rd:TypeName>Sy stem.String</rd:TypeName>
    </Field>
    <Field Name="APM_Proje ct_Start_Date">
    <DataField>APM_ Project_Start_D ate</DataField>
    <rd:TypeName>Sy stem.DateTime</rd:TypeName>
    </Field>
    <Field Name="APM_Proje ct_End_Date">
    <DataField>APM_ Project_End_Dat e</DataField>
    <rd:TypeName>Sy stem.DateTime</rd:TypeName>
    </Field>
    <Field Name="APM_Proje ct_InCharge">
    <DataField>APM_ Project_InCharg e</DataField>
    <rd:TypeName>Sy stem.String</rd:TypeName>
    </Field>
    <Field Name="APM_Proje ct_Desc">
    <DataField>APM_ Project_Desc</DataField>
    <rd:TypeName>Sy stem.String</rd:TypeName>
    </Field>
    <Field Name="APM_Proje ct_ID">
    <DataField>APM_ Project_ID</DataField>
    <rd:TypeName>Sy stem.Int32</rd:TypeName>
    </Field>
    <Field Name="APM_RECAD DID">
    <DataField>APM_ RECADDID</DataField>
    <rd:TypeName>Sy stem.String</rd:TypeName>
    </Field>
    <Field Name="APM_RECAD DDATE">
    <DataField>APM_ RECADDDATE</DataField>
    <rd:TypeName>Sy stem.DateTime</rd:TypeName>
    </Field>
    <Field Name="APM_RECUP DATEID">
    <DataField>APM_ RECUPDATEID</DataField>
    <rd:TypeName>Sy stem.String</rd:TypeName>
    </Field>
    <Field Name="APM_RECUP DATEDATE">
    <DataField>APM_ RECUPDATEDATE</DataField>
    <rd:TypeName>Sy stem.DateTime</rd:TypeName>
    </Field>
    </Fields>
    <Query>
    <DataSourceName >test1</DataSourceName>
    <CommandText>se lect * from av_project_mst where
    apm_project_id= @projectid</CommandText>
    <rd:UseGenericD esigner>true</rd:UseGenericDe signer>
    </Query>
    <rd:DataSetInfo >
    <rd:DataSetName >DataSet1</rd:DataSetName>
    <rd:TableName>A V_PROJECT_MST</rd:TableName>
    <rd:TableAdapte rName>AV_PROJEC T_MSTTableAdapt er</
    rd:TableAdapter Name>
    <rd:TableAdapte rFillMethod>Fil l</rd:TableAdapter FillMethod>
    <rd:TableAdapte rGetDataMethod> GetData</
    rd:TableAdapter GetDataMethod>
    </rd:DataSetInfo>
    </DataSet>
    </DataSets>
    <Width>10.83333 in</Width>
    <Body>
    <ReportItems>
    <Table Name="table1">
    <DataSetName>Da taSet1_AV_PROJE CT_MST1</DataSetName>
    <Top>0.75in</Top>
    <Details>
    <TableRows>
    <TableRow>
    <TableCells>
    <TableCell>
    <ReportItems>
    <Textbox Name="APM_Proje ct_Name">
    <rd:DefaultName >APM_Project_Na me</
    rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>2</ZIndex>
    <CanGrow>true </CanGrow>
    <Value>=First(F ields!APM_Proje ct_Name.Value)</
    Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    <TableCell>
    <ReportItems>
    <Textbox Name="APM_Proje ct_Start_Date">
    <rd:DefaultName >APM_Project_St art_Date</
    rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>1</ZIndex>
    <CanGrow>true </CanGrow>
    <Value>=First(F ields!
    APM_Project_Sta rt_Date.Value)</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    <TableCell>
    <ReportItems>
    <Textbox Name="textbox6" >
    <rd:DefaultName >textbox6</rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <CanGrow>true </CanGrow>
    <Value />
    </Textbox>
    </ReportItems>
    </TableCell>
    </TableCells>
    <Height>0.25i n</Height>
    </TableRow>
    </TableRows>
    </Details>
    <Header>
    <TableRows>
    <TableRow>
    <TableCells>
    <TableCell>
    <ReportItems>
    <Textbox Name="textbox1" >
    <rd:DefaultName >textbox1</rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>8</ZIndex>
    <CanGrow>true </CanGrow>
    <Value>APM Project Name</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    <TableCell>
    <ReportItems>
    <Textbox Name="textbox2" >
    <rd:DefaultName >textbox2</rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>7</ZIndex>
    <CanGrow>true </CanGrow>
    <Value>APM Project Start Date</Value>
    </Textbox>
    </ReportItems>
    </TableCell>
    <TableCell>
    <ReportItems>
    <Textbox Name="textbox3" >
    <rd:DefaultName >textbox3</rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>6</ZIndex>
    <CanGrow>true </CanGrow>
    <Value />
    </Textbox>
    </ReportItems>
    </TableCell>
    </TableCells>
    <Height>0.25i n</Height>
    </TableRow>
    </TableRows>
    </Header>
    <TableColumns >
    <TableColumn>
    <Width>3.61111i n</Width>
    </TableColumn>
    <TableColumn>
    <Width>3.61111i n</Width>
    </TableColumn>
    <TableColumn>
    <Width>3.61111i n</Width>
    </TableColumn>
    </TableColumns>
    <Height>0.75i n</Height>
    <Footer>
    <TableRows>
    <TableRow>
    <TableCells>
    <TableCell>
    <ReportItems>
    <Textbox Name="textbox7" >
    <rd:DefaultName >textbox7</rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>5</ZIndex>
    <CanGrow>true </CanGrow>
    <Value />
    </Textbox>
    </ReportItems>
    </TableCell>
    <TableCell>
    <ReportItems>
    <Textbox Name="textbox8" >
    <rd:DefaultName >textbox8</rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>4</ZIndex>
    <CanGrow>true </CanGrow>
    <Value />
    </Textbox>
    </ReportItems>
    </TableCell>
    <TableCell>
    <ReportItems>
    <Textbox Name="textbox9" >
    <rd:DefaultName >textbox9</rd:DefaultName>
    <Style>
    <PaddingLeft>2p t</PaddingLeft>
    <PaddingRight>2 pt</PaddingRight>
    <PaddingTop>2pt </PaddingTop>
    <PaddingBottom> 2pt</PaddingBottom>
    </Style>
    <ZIndex>3</ZIndex>
    <CanGrow>true </CanGrow>
    <Value />
    </Textbox>
    </ReportItems>
    </TableCell>
    </TableCells>
    <Height>0.25i n</Height>
    </TableRow>
    </TableRows>
    </Footer>
    </Table>
    </ReportItems>
    <Height>2in</Height>
    </Body>
    <Language>en-US</Language>
    <TopMargin>1i n</TopMargin>
    </Report>

    After this I created a aspx file and dragged the reportviewer control
    onto it which looks like following

    <rsweb:ReportVi ewer ID="ReportViewe r1"
    runat="server" Font-Names="Verdana" Font-Size="8pt"
    Height="400px" Width="560px">
    <LocalReport ReportPath="c:\ inetpub
    \wwwroot\sarvar pitgroup\av_sys tem\Report\Purc haseReport.rdlc ">
    <DataSources>
    <rsweb:ReportDa taSource
    DataSourceId="O bjectDataSource 1" Name="DataSet1_ AV_PROJECT_MST1 " />
    </DataSources>
    </LocalReport>
    </rsweb:ReportVie wer>
    <asp:ObjectData Source
    ID="ObjectDataS ource1" runat="server" SelectMethod="G etData"

    TypeName="DataS et1TableAdapter s.AV_PROJECT_MS TTableAdapter"
    DeleteMethod="D elete" InsertMethod="I nsert"
    OldValuesParame terFormatString ="original_{ 0}" UpdateMethod="U pdate">
    <DeleteParamete rs>
    <asp:Paramete r
    Name="Original_ APM_Project_ID" Type="Int32" />
    </DeleteParameter s>
    <UpdateParamete rs>
    <asp:Paramete r
    Name="APM_Proje ct_Name" Type="String" />
    <asp:Paramete r
    Name="APM_Proje ct_Start_Date" Type="DateTime" />
    <asp:Paramete r
    Name="APM_Proje ct_End_Date" Type="DateTime" />
    <asp:Paramete r
    Name="APM_Proje ct_InCharge" Type="String" />
    <asp:Paramete r
    Name="APM_Proje ct_Desc" Type="String" />
    <asp:Paramete r Name="APM_RECAD DID"
    Type="String" />
    <asp:Paramete r
    Name="APM_RECAD DDATE" Type="DateTime" />
    <asp:Paramete r
    Name="APM_RECUP DATEID" Type="String" />
    <asp:Paramete r
    Name="APM_RECUP DATEDATE" Type="DateTime" />
    <asp:Paramete r
    Name="Original_ APM_Project_ID" Type="Int32" />
    </UpdateParameter s>
    <SelectParamete rs>
    <asp:Paramete r Name="projectid "
    Type="Int32" />
    </SelectParameter s>
    <InsertParamete rs>
    <asp:Paramete r
    Name="APM_Proje ct_Name" Type="String" />
    <asp:Paramete r
    Name="APM_Proje ct_Start_Date" Type="DateTime" />
    <asp:Paramete r
    Name="APM_Proje ct_End_Date" Type="DateTime" />
    <asp:Paramete r
    Name="APM_Proje ct_InCharge" Type="String" />
    <asp:Paramete r
    Name="APM_Proje ct_Desc" Type="String" />
    <asp:Paramete r Name="APM_RECAD DID"
    Type="String" />
    <asp:Paramete r
    Name="APM_RECAD DDATE" Type="DateTime" />
    <asp:Paramete r
    Name="APM_RECUP DATEID" Type="String" />
    <asp:Paramete r
    Name="APM_RECUP DATEDATE" Type="DateTime" />
    </InsertParameter s>
    </asp:ObjectDataS ource>
    <br />
    </div>
    </form></td>

    In my vb file I'm doing the following
    Dim userid As New ReportParameter ("projectid" , "2")
    Dim p() As ReportParameter = {userid}
    ReportViewer1.L ocalReport.SetP arameters(p)
    ReportViewer1.L ocalReport.Refr esh()


    Please help.
    Thanks,
    Vishal
  • Rich P

    #2
    Re: Reportviewer not showing any data

    In the Report Design view, select your table and then select the upper
    left corner (cell) of your table outline to change the outline of the
    table to the fuzzy gray outline. Then right-click on that outline and
    select Properties. In the Properties dialog window that comes up -
    near the middle of the dialog where it says dataset - make sure that
    your dataset is listed in that dropdown textbox. If your dataset is not
    listed in the dropdown - try typing the name of the dataset in the
    textbox. Save then run. If the dataset name IS listed and you still
    don't have data - what you need to do is to physically drag a column
    from the table that makes up the dataset.

    Note: My experience with the Report control is that a table on the fly
    (dynamic) table won't work. I had to create a table in a persistent
    dataset (xsd). Create a table in the Dataset Designer (to get to the
    dataset designer just right-click on the dataset xsd file and click on
    "open") - create a table here - right-click and select "Add Table".
    Then from that table - physically drag each column into each cell of
    your Table control in the .rdlc. When you do this - you have to make
    sure that the Report control is referencing the correct datasource.

    Dim report As LocalReport = New LocalReport()

    '--I copied myRpt.rdlc to ...Debug\bin using Project\Propert ies --
    select the .rdlc file from the solution explorer - then select Build
    Action = "Content" and Copy To Output Directory = "Copy Always"

    report.ReportPa th = Application.Sta rtupPath & "\myRpt.rdl c"
    report.DataSour ces.Add(New ReportDataSourc e("DataSet1_MyT bl",
    Dataset1.MyTbl) )

    Save then run.

    When you drag the column into the table cell - you should see text
    something like this:

    Text1
    =Field!FirstNam e.Value
    Text2
    =Field!LastName .Value
    ...


    Rich

    *** Sent via Developersdex http://www.developersdex.com ***

    Comment

    Working...