none
DOWNLOAD PDF ASP.NET C# RRS feed

  • Question

  • I NEED TO DOWLOAD A PDF FROM SQL SERVER IN ASP.NET C#, I HAVE THE NEXT CODES, BUT THHE LINES ARE DOING NOTHING:

     InformesEntidad PCE = new InformesEntidad();
                PCE.dblRutCliente = txtRutCliente.Text.Trim() == "" ? 0 : double.Parse(txtRutCliente.Text.Trim());
                DataTable dt = InformesNegocio.DescargarPDF(PCE);

                if (dt != null && dt.Rows.Count > 0)
                {
                    string a = dt.Rows[0][0].ToString();
                    string b = dt.Rows[0][1].ToString();
                    Byte[] PDF = (Byte[])dt.Rows[0][2];
                    Response.Buffer = true;
                    Response.Charset = "";
                    Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    Response.ContentType = a;
                    Response.AddHeader("content-disposition", "attachment;filename=" + b);
                    Response.BinaryWrite(PDF);
                }



    Thursday, May 3, 2018 8:58 PM

All replies

  • Hi AntonioTM,

    This forum is a English forum, I would suggest that you could post you issue in English, it will beneficial to resolve the issue.

    In addition, could you please provide a bit more information about the issue, such as what kind of project template you are using, asp.net, Winforms or others. How do you save the pdf file in your database, a folder path, or byte type?

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 4, 2018 3:16 AM
  • Hi AntonioTM,

    According to your description, it seems that it is a asp.net issue, I would suggest that you could post your issue on asp.net forum suitable support.

    https://forums.asp.net/15.aspx/1?Getting+Started

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 8, 2018 8:32 AM