[英]Crystal report Error when navigating to next page?
I am making a reporting website using crystal report,using a button to view the report. 我正在使用Crystal Report创建一个报告网站,并使用一个按钮来查看报告。 The first page of the report is displayed without a problem but when I click the navigation buttons to move to the next page of the report, I either get an error 报告的第一页显示没有问题,但是当我单击导航按钮移至报告的下一页时,我遇到了一个错误
"Logon failed. Details: ADO Error Code: 0x Source: Microsoft SQL Native Client Description: Login failed for user 'sa'. SQL State: 28000 Native Error: Error in File C:\\DOCUME~1\\SOFTLITE\\ASPNET\\LOCALS~1\\Temp\\ClientReport {02A69EDD-9B03-4490-B3A2-5E5E5F5592D9}.rpt: Unable to connect: incorrect log on parameters." “登录失败。详细信息:ADO错误代码:0x源:Microsoft SQL Native Client说明:用户'sa'登录失败。SQL状态:28000本机错误:文件C:\\ DOCUME〜1 \\ SOFTLITE \\ ASPNET \\ LOCALS〜错误1 \\ Temp \\ ClientReport {02A69EDD-9B03-4490-B3A2-5E5E5F5592D9} .rpt:无法连接:错误的登录参数。”
or Crystal Reports shows an input box to log on in database. 或Crystal Reports显示输入框以登录数据库。 My code is: 我的代码是:
protected void Button1_Click(object sender, EventArgs e)
{
ReportDocument Summaryrpt = new ReportDocument();
Summaryrpt.Load(Server.MapPath("BookSummary.rpt"));
Summaryrpt.SetDatabaseLogon("sa", "nirvana", "Compro4", "lottery");
CrystalReportViewer1.ReportSource = Summaryrpt;
}
please help me........ 请帮我........
I found the solution 我找到了解决方案
protected void Button1_Click(object sender, EventArgs e)
{
ReportDocument Summaryrpt = new ReportDocument();
Summaryrpt.Load(Server.MapPath("BookSummary.rpt"));
CrystalReportViewer1.ReportSource = Summaryrpt;
var connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "ComproLottery.db.6456862.hostedresource.com";
connectionInfo.DatabaseName = "ComproLottery";
connectionInfo.Password = "Br0@dW@ys68";
connectionInfo.UserID = "ComproLottery";
connectionInfo.Type = ConnectionInfoType.SQL;
for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
{
CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.