Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Word Doc from Database

Word Doc from Database

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadminhelptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NinaWilliam
    wrote on last edited by
    #1

    Word Doc from Database Hi i am creating an application that help the user to upload his word documents to an sql server database i want to bind a datagrid to the database so the user can see what he uploaded. also, when the user clicks on the document title it will load it in Microsoft Word so he can read it. any idea how to bind the datagrid to the documents stored in the databse and how to load a document into Microsoft word? Nina

    A R 2 Replies Last reply
    0
    • N NinaWilliam

      Word Doc from Database Hi i am creating an application that help the user to upload his word documents to an sql server database i want to bind a datagrid to the database so the user can see what he uploaded. also, when the user clicks on the document title it will load it in Microsoft Word so he can read it. any idea how to bind the datagrid to the documents stored in the databse and how to load a document into Microsoft word? Nina

      A Offline
      A Offline
      Andrei_KS
      wrote on last edited by
      #2

      Hi, I appologise for my knowledge of English. I think you be able use table in data base - Name(char(50)), Data(text). Name for document title and Data for Ms Word document. For load document you be able use ASP.NET web handler's. Web handlers are software modules that handle raw HTTP requests received by ASP.NET. I be able send you sample use this handler's.

      1 Reply Last reply
      0
      • N NinaWilliam

        Word Doc from Database Hi i am creating an application that help the user to upload his word documents to an sql server database i want to bind a datagrid to the database so the user can see what he uploaded. also, when the user clicks on the document title it will load it in Microsoft Word so he can read it. any idea how to bind the datagrid to the documents stored in the databse and how to load a document into Microsoft word? Nina

        R Offline
        R Offline
        Ramasubramaniam
        wrote on last edited by
        #3

        Hi, This is very simple. 1) You store the word document in a specific folder on the server. 2) Store the filename and path details to a database table. 3) Select the files information and assign to a datagrid, on the datagrid make the file name as a hyperlink. 4) onclick of the link open the file by changing the content type. Ram

        N 1 Reply Last reply
        0
        • R Ramasubramaniam

          Hi, This is very simple. 1) You store the word document in a specific folder on the server. 2) Store the filename and path details to a database table. 3) Select the files information and assign to a datagrid, on the datagrid make the file name as a hyperlink. 4) onclick of the link open the file by changing the content type. Ram

          N Offline
          N Offline
          NinaWilliam
          wrote on last edited by
          #4

          can you show me a code sample of changing the content type?? and downloading the file?

          R 1 Reply Last reply
          0
          • N NinaWilliam

            can you show me a code sample of changing the content type?? and downloading the file?

            R Offline
            R Offline
            Ramasubramaniam
            wrote on last edited by
            #5

            Onclick event of an linkbuttton (which has file name as text) write this code(change variable names etc...) sFullFilePath is the file path (Retrieved from database table) System.IO.FileInfo oFileInfo = new System.IO.FileInfo(sFullFilePath); if(oFileInfo.Exists) { Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + sOrigFilename); Response.AddHeader("Content-Length", oFileInfo.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(sFullFilePath); Response.End(); } else { lblMessage.Text = "The file cannot be found."; } Ram

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups