我已经在 ms-sql server 2014 中创建了存储过程并创建了 rdlc 报告。现在以编程方式在reportviewer中绑定报表,但在报表中只显示列而不显示数据......
下面的代码是我的存储过程:
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管理工作室中检查......
我尝试的另一个 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()
在这里我收到错误:
我不知道它说什么...
帮我进来。