Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Retrieve pdf file from database

Author  Topic 

saeid2010
Starting Member

3 Posts

Posted - 2010-09-14 : 16:19:18
Hi
I generated project by c#.net 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.

Tags: C#, SQL2008, PDF, database

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-14 : 16:29:08
How did you save it to the database?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

saeid2010
Starting Member

3 Posts

Posted - 2010-09-14 : 18:37:13
Hi Tara Kizer,
I save it to the database by below code(c#):

SqlConnection cnn = new SqlConnection(cnnString);
SqlCommand scd = new SqlCommand();
scd.Connection = cnn;
scd.CommandText = "INSERT INTO DataBaseName (id, fileFormat, [file]) VALUES (@id, @fileFormat, @file)";
scd.Parameters.AddWithValue("@id", idNumber);//primary key
scd.Parameters.AddWithValue("@fileFormat", fileFormat);//file format
scd.Parameters.AddWithValue("@file", fileStream); //Actual File

cnn.Open();
scd.ExecuteNonQuery();
cnn.Close();
Go to Top of Page
   

- Advertisement -