[英]Report not displaying in Report Viewer
I have several reports displaying in my windows form application with no problems at all. 我在Windows窗体应用程序中显示了几份报告,完全没有问题。 I build them using the 'design new report' feature inside the report viewer with no code attached, other than a refresh when the page loads.
我使用报表查看器中的“设计新报表”功能来构建它们,不附加任何代码,而是在加载页面时刷新。
They are all working fine apart from one that is giving me a huge headache! 除了让我头疼的那一个之外,它们都工作正常。 There is nothing different with this one compared to the others as far as I can see, but this one displays 'No data available'?
就我所知,与其他相比,这没有什么不同,但是此显示为“无可用数据”?
There is data and I can preview it and display the data in a data grid view with no issues? 有数据,我可以预览它并在数据网格视图中显示数据,没有问题吗?
Are there certain reserved words or something that I am missing? 是否有某些保留字或我想念的东西? I am trying to display the total amount of payments from customers.
我正在尝试显示来自客户的付款总额。 As simple as that?
就如此容易?
Any help would be greatly appreciated! 任何帮助将不胜感激!
Code for data grid view: //Populate payments datagrid view private void displayInGrid_Payments(string sqlcmd) { paymentsDataGridView.Rows.Clear(); 数据网格视图的代码://填充付款数据网格视图私有void displayInGrid_Payments(string sqlcmd){paymentDataGridView.Rows.Clear();
connect.Open();
command.Connection = connect;
command.CommandText = sqlcmd;
reader = command.ExecuteReader();
while (reader.Read())
{
// add a row ( get index )
int arow = paymentsDataGridView.Rows.Add();
paymentsDataGridView.Rows[arow].Cells[0].Value = reader["Customer_ID"].ToString();
paymentsDataGridView.Rows[arow].Cells[1].Value = reader["Payment"].ToString();
paymentsDataGridView.Rows[arow].Cells[2].Value = reader["Payment_Date"].ToString();
}
reader.Close();
connect.Close();
}
//Display all payments
private void button_display_payments_Click(object sender, EventArgs e)
{
command.CommandText = "SELECT PAYMENTS.Customer_ID, PAYMENTS.Payment, PAYMENTS.Payment_Date "
+ "from PAYMENTS LEFT JOIN CUSTOMERS ON PAYMENTS.Customer_ID = CUSTOMERS.Customer_ID";
string cmd = command.CommandText;
displayInGrid_Payments(cmd);
}
I've had an issue in the past similar to this (like 5 years ago). 我过去有一个与此类似的问题(例如5年前)。
If you open your report rdlc file directly (it is just an XML file, open it in a text editor), and look for the datasources portion. 如果您直接打开报表rdlc文件(它只是一个XML文件,请在文本编辑器中打开它),然后查找数据源部分。 Make sure you do not have more than 1 listed in there, or it may cause problems like this.
确保您列出的位置不超过1个,否则可能会导致类似的问题。
I'm not sure the cause. 我不确定原因。 I was also using Visual Studio 2008 at the time.
当时我也在使用Visual Studio 2008。 Hope it helps.
希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.