Results 1 to 6 of 6

Thread: Retrieve a pdf document from database

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Moderator
    Join Date
    Oct 2005
    Answers
    305

    Retrieve a pdf document from database

    How can I retrieve a pdf document from database. Can any one give a query to save and retrieve pdf document?

    NOTE : [This question was asked by Naresh]


  2. #2
    Expert Member
    Join Date
    Dec 2006
    Answers
    204

    Re: Retrieve a pdf document from database

    pdf can be stored in database as BLOB.


  3. #3
    Junior Member
    Join Date
    Nov 2005
    Answers
    17

    Re: Retrieve a pdf document from database

    Barbie

    Thanks for the hint
    Can you post one sample code
    The associated queries such as to save/update pdf's and also
    How to retrieve pdf and show it in frontend?

    Thanks in adv
    Rajani


  4. #4
    Expert Member
    Join Date
    Dec 2006
    Answers
    204

    Re: Retrieve a pdf document from database

    Copy the file contents in a byte array using the file stream and insert the byte array into the database.
    The code will does it:

    FileStream fls=new FileStream(filename);
    byte[] blob=new byte[fls.Length];
    fls.Read(blob,0,System.Convert.ToInt32(fls.Length));
    string query="insert into applicant(name,resume) values(" + txtname.Text + "'," + blob+")";
    OracleCommand cmd=new OracleCommand(query,conn);
    cmd.ExecuteNonQuery();

    For retreiving, get it in a byte array(using select stmt) and display it.


  5. #5
    Moderator
    Join Date
    Oct 2005
    Answers
    305

    Re: Retrieve a pdf document from database

    Thanks for the sample code Barbie !


  6. #6
    Junior Member
    Join Date
    Nov 2005
    Answers
    17

    Re: Retrieve a pdf document from database

    WOW, This is really quick and cool, Thanks a ton Barbie... Way to go

    Cheers
    Rajani


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact