我正在使用水晶报告创建报告网站,使用按钮查看报告。 显示报告的第一页没有问题但是当我单击导航按钮移动到报告的下一页时,我得到一个错误
“登录失败。详细信息:ADO错误代码:0x源:Microsoft SQL Native Client描述:用户'sa'登录失败.SQL状态:28000本机错误:文件C中出错:\ DOCUME~1 \ SOFTLITE \ ASPNET \ LOCALS~1 \ Temp \ ClientReport {02A69EDD-9B03-4490-B3A2-5E5E5F5592D9} .rpt:无法连接:登录参数不正确。“
或Crystal Reports显示一个用于在数据库中登录的输入框。 我的代码是:
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;
}
请帮帮我........
答案 0 :(得分:1)
我找到了解决方案
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;
}
}