ASP.NET (MVC) 기반 응용 프로그램에서보고 서비스 보고서를 생성 중이지만 보고서 매개 변수를 설정하는 데 문제가 있습니다.Reporting Services 매개 변수를 설정할 수 없습니다.
SQL Server를 2005에서 2008 R2 (및 Reporting Services와 함께)로 업그레이드 한 이후에만 문제가 발생했다고 생각합니다. 원래 오류가 발생
는 호출 rsExec.Render에서였다
절차 또는 함수 'pCommunication_ReturnRegistrationLetterDetails' 파라미터가 제공되지 않은 '@guid'기대한다. 내가 rsExec.SetExecutionParameters는 다음과 같은 응답이 반환하는 것으로 나타났습니다 코드 디버깅
:
가 호출 할 수 없습니다
'NameOfApp.SQLRSExec.ReportExecutionService.SetExecutionParameters (NameOfApp.SQLRSExec.ParameterValue [], 문자열)' 그것은 웹 메소드이기 때문입니다. 여기
그것의 전체 기능입니다 :
public static bool ProduceReportToFile(string reportname, string filename, string[,] reportparams,
string fileformat)
{
bool successful = false;
SQLRS.ReportingService2005 rs = new SQLRS.ReportingService2005();
SQLRSExec.ReportExecutionService rsExec = new NameOfApp.SQLRSExec.ReportExecutionService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Prepare Render arguments
string historyID = null;
string deviceInfo = null;
// Prepare format - available options are "PDF","Word","CSV","TIFF","XML","EXCEL"
string format = fileformat;
Byte[] results;
string encoding = String.Empty;
string mimeType = String.Empty;
string extension = String.Empty;
SQLRSExec.Warning[] warnings = null;
string[] streamIDs = null;
// Define variables needed for GetParameters() method
// Get the report name
string _reportName = reportname;
string _historyID = null;
bool _forRendering = false;
SQLRS.ParameterValue[] _values = null;
SQLRS.DataSourceCredentials[] _credentials = null;
SQLRS.ReportParameter[] _parameters = null;
// Get if any parameters needed.
_parameters = rs.GetReportParameters(_reportName, _historyID,
_forRendering, _values, _credentials);
// Load the selected report.
SQLRSExec.ExecutionInfo ei =
rsExec.LoadReport(_reportName, historyID);
// Prepare report parameter.
// Set the parameters for the report needed.
SQLRSExec.ParameterValue[] parameters =
new SQLRSExec.ParameterValue[1];
// Place to include the parameter.
if (_parameters.Length > 0)
{
for (int i = 0; i < _parameters.Length; i++)
{
parameters[i] = new SQLRSExec.ParameterValue();
parameters[i].Label = reportparams[i,0];
parameters[i].Name = reportparams[i, 0];
parameters[i].Value = reportparams[i, 1];
}
}
rsExec.SetExecutionParameters(parameters, "en-us");
results = rsExec.Render(format, deviceInfo,
out extension, out encoding,
out mimeType, out warnings, out streamIDs);
// Create a file stream and write the report to it
using (FileStream stream = System.IO.File.OpenWrite(filename))
{
stream.Write(results, 0, results.Length);
}
successful = true;
return successful;
}
지금 매개 변수를 설정할 수 없습니다 해요 왜 어떤 아이디어? 매개 변수가 필요하지 않은 경우 보고서 생성은 문제없이 작동합니다.