You must Sign In to post a response.
  • Category: ASP.NET

    How to show error msg if record not found using vb.net

    How to show errror message if record not found when user select date it will search in database if data was there then it should convert binary data to pdf otherwise it should send error message data not found can anyone help how to show error message
  • #767120
    The data you saved in binary format , should be fetched back in same format, for e.g. if you save PDF file in database (in binary format) then it should be fetch back in same PDF format
    Now, if you save PDF file in database then you can use following code to convert it
    First read binary data in Byte Array (byte[])
    then run below code to display file

    context.Response.Buffer = true;
    context.Response.Charset = "";
    if (context.Request.QueryString["download"] == "1")
    {
    context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
    }
    context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    context.Response.ContentType = "application/pdf";
    context.Response.BinaryWrite(bytes);
    context.Response.Flush();
    context.Response.End();

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #767123
    Hi Prasad I added the same code but still its not working


  • Sign In to post your comments