Reportviewer not showing any data

G

gandhi.vishal

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.microsoft.com/sqlserver/reporting/
2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/
SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="test1">
<rd:DataSourceID>0ac0f7f1-9a46-4289-a79d-97cab9205b09</
rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString />
</ConnectionProperties>
</DataSource>
</DataSources>
<InteractiveHeight>11in</InteractiveHeight>
<ReportParameters>
<ReportParameter Name="projectid">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value />
</Values>
</DefaultValue>
<AllowBlank>true</AllowBlank>
<Prompt>Report_Parameter_0</Prompt>
</ReportParameter>
</ReportParameters>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<RightMargin>1in</RightMargin>
<LeftMargin>1in</LeftMargin>
<BottomMargin>1in</BottomMargin>
<rd:ReportID>4b5ab029-97b6-4439-966e-4a51232b81d2</rd:ReportID>
<DataSets>
<DataSet Name="DataSet1_AV_PROJECT_MST1">
<Fields>
<Field Name="APM_Project_Name">
<DataField>APM_Project_Name</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="APM_Project_Start_Date">
<DataField>APM_Project_Start_Date</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="APM_Project_End_Date">
<DataField>APM_Project_End_Date</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="APM_Project_InCharge">
<DataField>APM_Project_InCharge</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="APM_Project_Desc">
<DataField>APM_Project_Desc</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="APM_Project_ID">
<DataField>APM_Project_ID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="APM_RECADDID">
<DataField>APM_RECADDID</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="APM_RECADDDATE">
<DataField>APM_RECADDDATE</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
<Field Name="APM_RECUPDATEID">
<DataField>APM_RECUPDATEID</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="APM_RECUPDATEDATE">
<DataField>APM_RECUPDATEDATE</DataField>
<rd:TypeName>System.DateTime</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>test1</DataSourceName>
<CommandText>select * from av_project_mst where
apm_project_id=@projectid</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
<rd:DataSetInfo>
<rd:DataSetName>DataSet1</rd:DataSetName>
<rd:TableName>AV_PROJECT_MST</rd:TableName>
<rd:TableAdapterName>AV_PROJECT_MSTTableAdapter</
rd:TableAdapterName>
<rd:TableAdapterFillMethod>Fill</rd:TableAdapterFillMethod>
<rd:TableAdapterGetDataMethod>GetData</
rd:TableAdapterGetDataMethod>
</rd:DataSetInfo>
</DataSet>
</DataSets>
<Width>10.83333in</Width>
<Body>
<ReportItems>
<Table Name="table1">
<DataSetName>DataSet1_AV_PROJECT_MST1</DataSetName>
<Top>0.75in</Top>
<Details>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="APM_Project_Name">
<rd:DefaultName>APM_Project_Name</
rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
<ZIndex>2</ZIndex>
<CanGrow>true</CanGrow>
<Value>=First(Fields!APM_Project_Name.Value)</
Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="APM_Project_Start_Date">
<rd:DefaultName>APM_Project_Start_Date</
rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
<ZIndex>1</ZIndex>
<CanGrow>true</CanGrow>
<Value>=First(Fields!
APM_Project_Start_Date.Value)</Value>
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox6">
<rd:DefaultName>textbox6</rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.25in</Height>
</TableRow>
</TableRows>
</Details>
<Header>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<rd:DefaultName>textbox1</rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</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>2pt</PaddingLeft>
<PaddingRight>2pt</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>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
<ZIndex>6</ZIndex>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.25in</Height>
</TableRow>
</TableRows>
</Header>
<TableColumns>
<TableColumn>
<Width>3.61111in</Width>
</TableColumn>
<TableColumn>
<Width>3.61111in</Width>
</TableColumn>
<TableColumn>
<Width>3.61111in</Width>
</TableColumn>
</TableColumns>
<Height>0.75in</Height>
<Footer>
<TableRows>
<TableRow>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox7">
<rd:DefaultName>textbox7</rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</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>2pt</PaddingLeft>
<PaddingRight>2pt</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>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
<ZIndex>3</ZIndex>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
<Height>0.25in</Height>
</TableRow>
</TableRows>
</Footer>
</Table>
</ReportItems>
<Height>2in</Height>
</Body>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>

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

<rsweb:ReportViewer ID="ReportViewer1"
runat="server" Font-Names="Verdana" Font-Size="8pt"
Height="400px" Width="560px">
<LocalReport ReportPath="c:\inetpub
\wwwroot\sarvarpitgroup\av_system\Report\PurchaseReport.rdlc">
<DataSources>
<rsweb:ReportDataSource
DataSourceId="ObjectDataSource1" Name="DataSet1_AV_PROJECT_MST1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource
ID="ObjectDataSource1" runat="server" SelectMethod="GetData"

TypeName="DataSet1TableAdapters.AV_PROJECT_MSTTableAdapter"
DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" UpdateMethod="Update">
<DeleteParameters>
<asp:parameter
Name="Original_APM_Project_ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter
Name="APM_Project_Name" Type="String" />
<asp:parameter
Name="APM_Project_Start_Date" Type="DateTime" />
<asp:parameter
Name="APM_Project_End_Date" Type="DateTime" />
<asp:parameter
Name="APM_Project_InCharge" Type="String" />
<asp:parameter
Name="APM_Project_Desc" Type="String" />
<asp:parameter Name="APM_RECADDID"
Type="String" />
<asp:parameter
Name="APM_RECADDDATE" Type="DateTime" />
<asp:parameter
Name="APM_RECUPDATEID" Type="String" />
<asp:parameter
Name="APM_RECUPDATEDATE" Type="DateTime" />
<asp:parameter
Name="Original_APM_Project_ID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:parameter Name="projectid"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:parameter
Name="APM_Project_Name" Type="String" />
<asp:parameter
Name="APM_Project_Start_Date" Type="DateTime" />
<asp:parameter
Name="APM_Project_End_Date" Type="DateTime" />
<asp:parameter
Name="APM_Project_InCharge" Type="String" />
<asp:parameter
Name="APM_Project_Desc" Type="String" />
<asp:parameter Name="APM_RECADDID"
Type="String" />
<asp:parameter
Name="APM_RECADDDATE" Type="DateTime" />
<asp:parameter
Name="APM_RECUPDATEID" Type="String" />
<asp:parameter
Name="APM_RECUPDATEDATE" Type="DateTime" />
</InsertParameters>
</asp:ObjectDataSource>
<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.LocalReport.SetParameters(p)
ReportViewer1.LocalReport.Refresh()


Please help.
Thanks,
Vishal
 
R

Rich P

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\Properties --
select the .rdlc file from the solution explorer - then select Build
Action = "Content" and Copy To Output Directory = "Copy Always"

report.ReportPath = Application.StartupPath & "\myRpt.rdlc"
report.DataSources.Add(New ReportDataSource("DataSet1_MyTbl",
Dataset1.MyTbl))

Save then run.

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

Text1
=Field!FirstName.Value
Text2
=Field!LastName.Value
...


Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top