使用Asp.Net的Crystal Report [英] Crystal Report using Asp.Net

查看:62
本文介绍了使用Asp.Net的Crystal Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DataSet dtUser = new DataSet();
            SqlCommand cmd = dcon.CreateCommand("Get_AllUser", true);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dtUser);
            if (dtUser.Tables[0].Rows.Count > 0)
            {
                dtUser.Tables[0].Columns.Add("S_No");
                for (int i = 0; i <= dtUser.Tables[0].Rows.Count - 1; i++)
                {
                    dtUser.Tables[0].Rows[i]["S_No"] = i + 1;
                }
            }
            ReportDocument report = new ReportDocument();
            dsUserEntry ds = new dsUserEntry();
            ds.Tables[0].Merge(dtUser.Tables[0]);
            
            report.Load(Server.MapPath("RepotUserEntry.rpt"));
            report.SetDataSource(ds);
            CrystalReportViewer1.ReportSource = report;
        }
        catch (Exception ex) { throw ex; }
        finally { dcon.CloseConnection(); }



上面的代码用于水晶报表.
它显示报告,但是当我单击Crystal报告的打印按钮时
发生以下错误:
您请求的报告需要更多信息.
dsUserEntry
ServerName:dsUserEntry
数据库名称:
用户名:
密码:

如何解决此问题



Above code using for crystal report.
its display the report but when i clicked the print button of crystal report
following error occured:
The report you requested requires further information.
dsUserEntry
ServerName:dsUserEntry
Database name:
user name:
Password:

how to solve this problem

推荐答案

您需要添加Database的登录凭据,如下所示

You need to add the login credentials of Database as below

protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument crystalReport = new ReportDocument();
        crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
        crystalReport.SetDatabaseLogon
            ("amit", "password", @"AMIT\SQLEXPRESS", "TestDB");
        CrystalReportViewer1.ReportSource = crystalReport;
    }


将TableLogOnInfo添加到报表中.
Add The TableLogOnInfo to your report.


您必须在运行时设置登录信息.
C#Crystal Reports动态登录参数 [
You have to set logon information at run time.
C# Crystal Reports Dynamic Logon parameters [^]


这篇关于使用Asp.Net的Crystal Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆