Saving doc file in sql database
i have developed window application , and i need to save doc file in sql database from my application. should there be binary field in database to save such files? or which datatype should i use? and how can i do that using c#.net 2005? need solution....

Serban Cosmin59 reputationPosted Sep 20, 2009, 9:08 AM EDT
Lalit MRank #1,186 · 1.5K reputationPosted Nov 11, 2009, 11:07 PM EST
Add reference to Microsoft Office 11.0 Object Library using the Add Reference dialog box.
using Microsoft.Office.Core;
using System.Reflection;
public void CreateDoc()
{
object missing = System.Reflection.Missing.Value;
object endOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
//Start Word and create a new document.
Word._Application word = new Word.Application();
Word._Document document = word.Documents.Add(ref missing, ref missing, ref missing, ref missing);
//Insert a paragraph at the beginning of the document.
Word.Paragraph para1;
para1 = document.Content.Paragraphs.Add(ref missing);
para1.Range.Text = "Adding paragraph thru C#";
para1.Range.Font.Bold = 1;
para1.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
para1.Format.SpaceAfter = 24; //24 pt spacing after paragraph.
para1.Range.InsertParagraphAfter();
word.Visible = true;
document.Save();
document.Close(ref missing, ref missing, ref missing);
word.Quit(ref missing, ref missing, ref missing);
}
more info