VS2010 Crystal Reports 通过代码发送数据集时要求登录.

2

本文介绍了VS2010 Crystal Reports 通过代码发送数据集时要求登录.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在我的项目中创建了一个数据集 (.xsd) 和报告 (.rpt) 文件.我通过代码填充我的数据集,然后将其设置为报告的 SetDataSource,它显示第一页很好,但其他任何内容,如下一页或导出触发登录弹出窗口.

I've created a Dataset (.xsd) and Report (.rpt) files in my project. I fill my Dataset via code and then set it to the Report's SetDataSource, it shows the first page fine but anything else, like next page or export triggers a login popup.

我做错了什么?没有用户或通行证(我猜),因为我没有直接访问数据库.

What am I doing wrong? Theres no user or pass (I guess) since I'm not making a direct access to the DB.

        List<TBL_PAG_SEGURO_VENDASFields> list = controle.GetRelatorioAll();
        vendasDS ds = new vendasDS();
        foreach(TBL_PAG_SEGURO_VENDASFields item in list)
        {
            DataRow row = ds.Tables["vendas"].NewRow();
            row[0] = item.RAZAO_SOCIAL;
            row[1] = item.DT_VENDA;
            row[2] = item.TRANSACAO_ID;
            row[3] = item.SITUACAO;
            row[4] = item.NOME;
            row[5] = item.VALOR_VENDA;
            row[6] = item.DT_LIBERACAO_PAGTO;
            row[7] = item.HISTORICO_ALTERACOES;
            row[8] = item.DT_FINAL_SERVICE;
            ds.Tables["vendas"].Rows.Add(row);
        }
        ReportDocument reportDocument = new ReportDocument();
        string filePath = Request.PhysicalApplicationPath + "Recursos/Reports/vendasCR.rpt";                
        reportDocument.Load(filePath);
        reportDocument.SetDataSource(ds);
        crv_Vendas.ReportSource = reportDocument;

推荐答案

代码是对的,我做错的是在我的报告中使用自定义连接设置数据集文件,重新创建它,将数据集设置为 ADO.NET 连接并在 Page_Init 中进行代码调用解决了我的问题.

The code is right, what I was doing wrong is setting the dataset file with a custom connection in my report, recreated it setting the dataset as ADO.NET Connection and making the code call inside Page_Init solved my problem.

这篇关于VS2010 Crystal Reports 通过代码发送数据集时要求登录.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14