Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 方法'没有重载;渲染';接受1个参数_C# 4.0_C# 3.0 - Fatal编程技术网

C# 4.0 方法'没有重载;渲染';接受1个参数

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

这是我的代码,我为我的项目编写了一份pdf报告

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);