- 
	
	
		
			
			
				Moderator
			
			
			
			
				
					
						  
 
					    
				 
 
			
				
				
				
					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]
 
 
 
 
 
 
 
 
 
- 
	
	
		
			
			
				Expert Member
			
			
			
			
				
					
						  
 
					    
				 
 
			
				
				
				
					Re: Retrieve a pdf document from database
				
					
						
							pdf can be stored in database as BLOB.
 
 
 
 
 
 
 
 
 
- 
	
	
		
			
			
				Junior Member
			
			
			
			
				
					
						  
 
					    
				 
 
			
				
				
				
					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
 
 
 
 
 
 
 
 
 
- 
	
	
		
			
			
				Expert Member
			
			
			
			
				
					
						  
 
					    
				 
 
			
				
				
				
					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.
 
 
 
 
 
 
 
 
 
- 
	
	
		
			
			
				Moderator
			
			
			
			
				
					
						  
 
					    
				 
 
			
				
				
				
					Re: Retrieve a pdf document from database
				
					
						
							Thanks for the sample code Barbie !
 
 
 
 
 
 
 
 
 
- 
	
	
		
			
			
				Junior Member
			
			
			
			
				
					
						  
 
					    
				 
 
			
				
				
				
					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
				Posting Permissions
			
			
				
	
		- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-  
Forum Rules