visual studio Crystal报告更改缩放级别请求连接凭据

时间:2017-03-11 06:20:01

标签: visual-studio-2015 crystal-reports

我正在使用视觉工作室的SAP水晶报告。第一次运行时,它与我运行时设置的数据源一起工作正常。但是当我更改缩放级别时,它会提示输入数据库名称,用户名和密码。我被困在这两天了。请帮忙

credentials prompt

var resultData = GetExpenseData(fromDate, toDate);
ReportDocument document = new ReportDocument();
document.Load(Server.MapPath("~/Reporting/ExpenseReport.rpt"));

document.SetDataSource(resultData);   

    ParameterDiscreteValue param1 = new ParameterDiscreteValue();
param1.Value = fromDate;
ParameterDiscreteValue param2 = new ParameterDiscreteValue();
param2.Value = toDate;

ParameterDiscreteValue param3 = new ParameterDiscreteValue();
param3.Value = templeName;

ParameterFieldDefinitions fieldDefinitions = document.DataDefinition.ParameterFields;
ParameterFieldDefinition fromDateFieldLocation = document.DataDefinition.ParameterFields[0];
ParameterValues fromDateParameterValues = fromDateFieldLocation.CurrentValues;
fromDateParameterValues.Add(param1);
fromDateFieldLocation.ApplyCurrentValues(fromDateParameterValues);

ParameterFieldDefinition toDateFieldLocation = document.DataDefinition.ParameterFields[1];
ParameterValues toDAteParameterValues = toDateFieldLocation.CurrentValues;
toDAteParameterValues.Add(param2);
toDateFieldLocation.ApplyCurrentValues(toDAteParameterValues);

ParameterFieldDefinition templeFieldLocation = document.DataDefinition.ParameterFields[2];
ParameterValues templeParameterValues = templeFieldLocation.CurrentValues;
templeParameterValues.Add(param3);
templeFieldLocation.ApplyCurrentValues(templeParameterValues);                       

CrystalReportViewer1.ReportSource = document;

1 个答案:

答案 0 :(得分:0)

Crystal Report需要登录:

请参阅此link