1
我在ms-sql server 2014中创建了存储过程并创建了rdlc报告。现在结合中的ReportViewer报告编程,但在报告仅列显示,而不是数据...reportviewer中未加载数据VB.NET
下面的代码是我的存储过程:
USE [Bonny]
GO
/****** Object: StoredProcedure [dbo].[AccMast_AllDetail] Script Date: 17/10/2016 12:10:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[AccMast_AllDetail]
as
Select Account_Code,Party_Name,Address_1,Address_2,City from FAMPAR order by Account_Code
GO
我在的ReportViewer形式负载VB.NET代码事件...
ReportViewer.Reset()
Dim data As New AccMastDataSet
Dim ReportDataSource1 As ReportDataSource = New ReportDataSource
ReportDataSource1.Name = "AccMastDataSet"
ReportDataSource1.Value = rds
ReportViewer.LocalReport.DataSources.Clear()
ReportViewer.LocalReport.DataSources.Add(ReportDataSource1)
ReportViewer.LocalReport.ReportEmbeddedResource = "Report1.rdlc"
ReportViewer.LocalReport.ReportPath = "D:\netbonny\netbonnyproject\netbonnyproject\Reports\Report1.rdlc"
ReportViewer.RefreshReport()
在此我得到列标题而不是数据,数据是存在的,在SQL Management Studio中检查...
另一个VB。 NET代码我想的是:
Dim data As New AccMastDataSet
Dim abc = data.Tables("AccMast_AllDetail")
Dim rds = New Microsoft.Reporting.WinForms.ReportDataSource("AccMastDataSet", data)
ReportViewer.LocalReport.DataSources.Clear()
ReportViewer.LocalReport.DataSources.Add(rds)
ReportViewer.LocalReport.ReportEmbeddedResource = "netbonnyproject.Report1.rdlc"
ReportViewer.RefreshReport()
在这里,我得到错误:
我不知道它说什么......
帮我在这里。
OMG!我很高兴看到我的数据进入ReportViewer Atlast ... #cry ........... Thanx很多。而且,我没有使用'Dim rds = New Microsoft.Reporting.WinForms.ReportDataSource(“DataSet1”,table)',我直接将表放置在'ReportDataSource1.Value = table'中并且它的工作...谢谢很多@RezaAghaei .. – bonny
实际上我混合两个代码,所以有两个ReportDataSource ...无论如何,我现在感到安心,再次thanx @RezaAghaei – bonny
太棒了!别客气 :) –