0
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{ ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new Uri(@"http://123.abc/Reportserver");
ReportViewer1.ServerReport.ReportPath = "/Test/Development/Details";
ReportViewer1.ShowParameterPrompts = true;
ReportViewer1.ShowPrintButton = true;
ReportParameter[] rptParams = new ReportParameter[1];
SqlConnection MA = new SqlConnection(MedA);
SqlCommand command = new SqlCommand("select distinct Users from PROD.Users Where Username ='" + this.Username + "'", MA);
SqlDataAdapter dataAadpter = new SqlDataAdapter(command);
DataSet ds = new DataSet();
dataAadpter.Fill(ds);
rptParams[0] = new ReportParameter("UserID", ds); //this.Username
ReportViewer1.ServerReport.SetParameters(rptParams);
ReportViewer1.ServerReport.Refresh();
ReportViewer1.AsyncRendering = false;
ReportViewer1.SizeToReportContent = true;
}
我無法傳遞參數。我試圖從登錄用戶獲取用戶密鑰。誰能幫我將參數存儲在報表查看器的變量中
您的報表服務器安全性是如何配置的? Windows身份驗證或表單身份驗證。如果它是Windows認證爲什麼你需要傳遞給用戶?你正在跳到另一臺機器上嗎? – Daniel
@Daniel我正在使用表單身份驗證。我有一個來自我的用戶名的登錄頁面。使用用戶名,我從DB獲取密鑰。 – Valley