我在绑定Crystal Reports中的动态URL时遇到麻烦。我只想将URL设置为“图像的虚拟路径”而不是物理路径。
以下是我的代码。
public void ViewImages(int a)
{
try
{
string result = " ";
string sql = Session["ReportSQL"].ToString();
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
SystemReport cml = new SystemReport();
da.Fill(cml, "DocumentManager");
con.Close();
foreach (DataRow row in cml.Tables["DocumentManager"].Rows)
{
row["Path"] = row["Path"];
result = "../images/"+row["Path"].ToString();
}
ReportDocument cm = new ReportDocument();
cm.Load(Server.MapPath("~/Reports/ShowImage.rpt"));
cm.SetDataSource(cml);
Viewer.ReportSource = cm;
Viewer.DataBind();
}
catch (Exception ex)
{
throw ex;
}
}