需要使用.rdlc
报告在ASP.NET应用程序中显示tiff图像的帮助。图像存储在其他服务器中,路径存储在SQL Server数据库中。
从SQL Server数据库以以下格式检索的图像路径:
\\ServerName\images\07032018\78700057.tif
代码:
public partial class Default : System.Web.UI.Page
{
string conStr = @"Data Source=server;Database=db;Integrated Security=true;";
protected void Page_Load(object sender, EventArgs e)
{
}
private DataTable GetPhoto()
{
DataTable dt = new DataTable();
using (SqlConnection cn = new SqlConnection(conStr))
{
SqlCommand cmd = new SqlCommand("spRFND_GET_SCT_APPLLIED_REFUNDS", cn);
cmd.CommandType = CommandType.StoredProcedure;
cn.Open();
SqlDataReader reader = cmd.ExecuteReader();
dt.Load(reader);
}
return dt;
}
protected void Button1_Click(object sender, EventArgs e)
{
//reset
ReportViewer1.Reset();
//data source
DataTable dt = GetPhoto();
ReportDataSource rds = new ReportDataSource("DataSet1", dt);
ReportViewer1.LocalReport.DataSources.Add(rds);
//Path
ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
ReportViewer1.LocalReport.EnableExternalImages = true;
ReportViewer1.LocalReport.EnableHyperlinks = true;
//refresh
ReportViewer1.LocalReport.Refresh();
}
}