0
я пытаюсь открыть отчет кристалла в моем сайте, но его дает ошибку Вот код, я попробовалОшибка открытия Crystal Report в ASP.NET
protected void report_view(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
cryRpt.Load("C:\\Report1.rpt");
crConnectionInfo.ServerName = "local";
crConnectionInfo.DatabaseName = "MyEmployees";
crConnectionInfo.UserID = "MYLAPTOP\\HOME";
CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
CrystalReportViewer1.ReportSource = cryRpt;
CrystalReportViewer1.RefreshReport();
}
и здесь ошибка показана на CrystalReportViwer
Failed to open the connection. Failed to open the connection. Report1 {1222DD0B-C24E- 4E66-8EE1-7ED7F5F0D6B4}.rpt
Я использую Visual Studio 2010 с Crystal Reports 11
не защищен паролем. , , –
лично я сомневаюсь, что имя сервера, база данных является локальной, поэтому поэтому я помещаю имя сервера как локальное, то же самое, что и в SqlServer UserID, также такое же, как в SqlServer. Имя пользователя –
Метод SetDataBaseLogon() работал для меня, спасибо @Conrad Lotz –