Click here to Skip to main content
13,147,689 members (30,494 online)
Rate this:
Please Sign up or sign in to vote.
I generated project by and sql server 2008.I saved doc/pdf file in database.

Now,I want to retrieve doc/pdf file from database and open it by Microsoft Word/Adobe Acrobat software(Microsoft Word/Adobe Acrobat software was installed in my computer).

Please guide me,Thanks.
Posted 14-Sep-10 10:13am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Did you even try to Google for an answer? It's pretty obvious. You save the file data as a file, then launch Adobe Acrobat, telling it which file to open. If you need to know how to do any of that, feel free to Google for it. If you are still having problems after having tried to solve them yourself, we're here to help.
saeid2010 14-Sep-10 18:27pm
Hi aspdotnetdev,
i have a method for it:

1- bring binary data from database to dataset
2- convert binary data to byte[] type in dataset
3- write it in target path
4- call specific program for it(c#: process.start(path);)

But,it's long way.
i want to find another way(short way) for solve it.

aspdotnetdev 14-Sep-10 18:54pm
Not sure what you mean by "short way". Seems like you have a perfectly good method of displaying the PDF. Is there some reason that's not working for you? What problem are you trying to solve?
saeid2010 15-Sep-10 0:33am
I want another way that i don't have 3 and 4 step.
I call specific program for it straightly.
ThatsAlok 17-Sep-10 11:10am
saeid answer would be correct approach. we use this kind of approach in one of our product.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Try This Way :
Code in C#
using System;
using System.Xml;
using System.Web.Configuration;
using System.Web;
using System.Web.SessionState;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Diagnostics;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI;
public class AdClickHandler : IHttpHandler
        public void ProcessRequest(HttpContext context)
                context.Response.AppendHeader("Pragma", "no-cache");
                context.Response.AppendHeader("Cache-Control", "no-cache");
                context.Response.CacheControl = "no-cache";
                context.Response.Expires = -1;
                context.Response.ExpiresAbsolute = new DateTime(1900, 1, 1);
        context.Response.ContentType = "application/application/"; // Get approprivate Content type mime type
        public bool IsReusable
                return false;

try the same application/application/
with Ms-Word
Hope It Helps
saeid2010 25-Nov-10 2:13am
Hi my friend
TNX a lot
bsty123 8-Jul-11 5:06am
ya its good but how to use this handler in gridview where pdf id is display in column.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

it takes long time.
I want to have this way:

1- bring binary data from database to dataset
2- convert binary data to byte[] type in dataset
3- call specific program for it.

Simon Dufour 17-Sep-10 16:08pm
You can't feed byte data to Acrobat Reader without saving it in a file. Take the data, save it as a .pdf file and launch the app normally.
saeid2010 19-Sep-10 15:44pm
it's only way for my question?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 18 Nov 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100