C# 4.0 方法'没有重载;渲染';接受1个参数
这是我的代码,我为我的项目编写了一份pdf报告C# 4.0 方法'没有重载;渲染';接受1个参数,c#-4.0,c#-3.0,C# 4.0,C# 3.0,这是我的代码,我为我的项目编写了一份pdf报告 public partial class Report : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { getreport(); } } public override void Verify
public partial class Report : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
getreport();
}
}
public override void VerifyRenderingInServerForm(Control control)
{
// base.VerifyRenderingInServerForm(control);
}
public void getreport()
{
string province = Request.QueryString["Province"].ToString();
string district = Request.QueryString["District"].ToString();
string village = Request.QueryString["Village"].ToString();
ReportViewer1.ProcessingMode = ProcessingMode.Local;
LocalReport rep = ReportViewer1.LocalReport;
rep.ReportPath = @"Report.rdlc";
ReportDataSource dsRep = new ReportDataSource();
dsRep.Name = "DataSet1";
dsRep.Value = GetDataTable(province, district, village);
rep.DataSources.Clear();
rep.DataSources.Add(dsRep);
//ReportViewer1.DocumentMapCollapsed = true;
//ReportViewer1.ShowPrintButton = true;
//rep.Render("PDF");
byte[] result = null;
result = rep.Render("PDF");
Response.ClearContent();
Response.AppendHeader("content-length", result.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(result);
Response.Flush();
Response.Close();
rep.Refresh();
}
protected DataTable GetDataTable(string p,string d,string v)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DBConnectionString"].ToString());
DataTable dt;
SqlDataAdapter da;
SqlCommand cmd;
string filter = "";
try
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
cmd = new SqlCommand("select '" +p + "' as UserName, '"+d+"'Password,'"+ v+"' as category", con);
da = new SqlDataAdapter(cmd);
dt = new DataTable();
da.Fill(dt);
cmd.Dispose();
con.Close();
return dt;
}
catch (Exception ex)
{
return null;
}
}
Render方法确实具有,但不在中 您必须按如下方式调用重载
string extension;
string encoding;
string mimeType;
string extension;
string[] streams;
Warning[] warnings;
result = rsExec.Render("PDF", null,
out extension, out encoding,
out mimeType, out streams, out warnings);
Render方法确实具有,但不在中 您必须按如下方式调用重载
string extension;
string encoding;
string mimeType;
string extension;
string[] streams;
Warning[] warnings;
result = rsExec.Render("PDF", null,
out extension, out encoding,
out mimeType, out streams, out warnings);