Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL-Server
hello, can u guide how to store rtf file into database,retriving

protected void Button1_Click(object sender, EventArgs e)
   if (FileUpload1.HasFile && FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
         HttpPostedFile file = FileUpload1.PostedFile;
public void ConvertDocToRTF(string DocPath)
    //Create object of documnet .
    Document document = new Document();
       //Load doc file from given path
       //Save doc file. It will convert to .Rtf format .
       document.SaveToFile("Tesfile.rtf", FileFormat.Rtf);
    catch (Exception) { throw; }
Posted 19-Feb-12 17:20pm
Edited 19-Feb-12 18:30pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Question is unclear. Do you want to store the file itself, or just the contents?
If you want to store the file you need a LOB[^] type, more specifically a BLOB. An alternative in keeping the file, but not uploading to the database is saving the file in a DMS (document management system) and saving the link to the location.
If you want to save the rtf text you can do so via richtextbox, although I don't know how it will react on complex documents (headers, tables, images, ...).
The link has a sample in ADO.Net, but any other provider will have something similar.
Read it through, if you have more specific questions, update this question with more info.
Hope this helps.

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

  Print Answers RSS
0 OriginalGriff 435
1 Sergey Alexandrovich Kryukov 200
2 Yogesh Kumar Tyagi 180
3 Richard Deeming 180
4 RyanDev 115
0 Sergey Alexandrovich Kryukov 6,405
1 OriginalGriff 5,798
2 CPallini 2,473
3 Richard MacCutchan 1,647
4 Abhinav S 1,530

Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 20 Feb 2012
Copyright © CodeProject, 1999-2014
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