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. Saving Word File into SQL Server

Saving Word File into SQL Server

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadmin
6 Posts 4 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.
  • S Offline
    S Offline
    Shivan Nandan
    wrote on last edited by
    #1

    Hello friends, My idea is given below. While clicking a button, mas-word should open within the browser with an existing Template file (.dot). After typing its contents and clicking save button, it will come back to the aspx page. Then I will fill other details of the file in aspx page and finally click Submit. Then the word file should be saved into SQL server table. I should be able to open that word file later from SQL server table itself. Can anybody give the code for this logic Regards Shivan

    Shivanandan C V

    A N W 3 Replies Last reply
    0
    • S Shivan Nandan

      Hello friends, My idea is given below. While clicking a button, mas-word should open within the browser with an existing Template file (.dot). After typing its contents and clicking save button, it will come back to the aspx page. Then I will fill other details of the file in aspx page and finally click Submit. Then the word file should be saved into SQL server table. I should be able to open that word file later from SQL server table itself. Can anybody give the code for this logic Regards Shivan

      Shivanandan C V

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      My Suggestion, Never store files on SQL Server, Stored files on Hard Drive and Store the path into Table , retrieve the files name from database and open the file from corresponding path !!

      cheers, Abhijit

      1 Reply Last reply
      0
      • S Shivan Nandan

        Hello friends, My idea is given below. While clicking a button, mas-word should open within the browser with an existing Template file (.dot). After typing its contents and clicking save button, it will come back to the aspx page. Then I will fill other details of the file in aspx page and finally click Submit. Then the word file should be saved into SQL server table. I should be able to open that word file later from SQL server table itself. Can anybody give the code for this logic Regards Shivan

        Shivanandan C V

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        Shivan Nandan wrote:

        While clicking a button, mas-word should open within the browser with an existing Template file (.dot).

        That's not possible in web application. You have to provide an option for user to download the template file. Let them fill it and come back to your webpage for uploading it.

        Shivan Nandan wrote:

        hen the word file should be saved into SQL server table.

        Try to avoid keeping files in SQL server unless there is a strong need for that. Keep the file in server HDD and store the path in database. Files are kept in SQL server database in BLOB fields. You have to use varbinary(max) type.

        Navaneeth How to use google | Ask smart questions

        W 1 Reply Last reply
        0
        • S Shivan Nandan

          Hello friends, My idea is given below. While clicking a button, mas-word should open within the browser with an existing Template file (.dot). After typing its contents and clicking save button, it will come back to the aspx page. Then I will fill other details of the file in aspx page and finally click Submit. Then the word file should be saved into SQL server table. I should be able to open that word file later from SQL server table itself. Can anybody give the code for this logic Regards Shivan

          Shivanandan C V

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          Shivan Nandan wrote:

          Then the word file should be saved into SQL server table

          Although there are different opinions whether this should be done or not, if you still consider storing the data into the database, perhaps this would help: http://www.codeproject.com/KB/database/SqlFileStream.aspx[^]

          The need to optimize rises from a bad design.My articles[^]

          1 Reply Last reply
          0
          • N N a v a n e e t h

            Shivan Nandan wrote:

            While clicking a button, mas-word should open within the browser with an existing Template file (.dot).

            That's not possible in web application. You have to provide an option for user to download the template file. Let them fill it and come back to your webpage for uploading it.

            Shivan Nandan wrote:

            hen the word file should be saved into SQL server table.

            Try to avoid keeping files in SQL server unless there is a strong need for that. Keep the file in server HDD and store the path in database. Files are kept in SQL server database in BLOB fields. You have to use varbinary(max) type.

            Navaneeth How to use google | Ask smart questions

            W Offline
            W Offline
            Wendelius
            wrote on last edited by
            #5

            N a v a n e e t h wrote:

            Try to avoid keeping files in SQL server unless there is a strong need for that

            Just for curiosity, why not to store the documents into SQL Server.

            The need to optimize rises from a bad design.My articles[^]

            N 1 Reply Last reply
            0
            • W Wendelius

              N a v a n e e t h wrote:

              Try to avoid keeping files in SQL server unless there is a strong need for that

              Just for curiosity, why not to store the documents into SQL Server.

              The need to optimize rises from a bad design.My articles[^]

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              That realy depends. I felt difficulties to manage the files which are kept in database. On a shared hosting, you will have limited database space and more HDD space. So keeping files in database will increase DB size and you will run out of the limit easily. For accessing the file, you need to query the database, and write to response with correct content type. If the file is in HDD, you only have to take the file path from DB and redirect to it. Since files are stored in varbinary column, I think no SQL functions can be applied to it. So IMO it is pointless. Please correct me if I am wrong :)

              Navaneeth How to use google | Ask smart questions

              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