none
how to save content in word document in database RRS feed

  • Question

  • I have 10000 word document and i want save  the contents in document in tables 

    and the table design is 

    id 

     content   ntext 

    docName  nvarchar(250)

    Tuesday, June 16, 2015 9:36 AM

Answers

All replies

  • If you want the text, you can use a SQL server datatype (not the nvarchar(250))

    If you want to save the document do it as an image (in fact a bytearray).

    For the first ask this in the forum for SQL Server Transact code.

    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=transactsql

    If you want to same it as image than take a look on our website.

    http://www.vb-tips.com/DataBaseInsertImageSimpleWay.ASPX


    Success
    Cor

    Tuesday, June 16, 2015 9:57 AM
  • I want to save content not the file 
    Thursday, June 18, 2015 9:30 AM
  • I want to save content not the file 

    Like I wrote already, that is not a question for this forum but for the forum which I gave in my previous reply. 

    Your nvarchar(250) is wrong.

    https://msdn.microsoft.com/en-us/library/ms186939.aspx

    If it is about the VB code then it is simply an Insert or and update stransact code with an ExecuteScalar

    Description and sample on this page.

    https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar(v=vs.110).aspx


    Success
    Cor


    Thursday, June 18, 2015 9:57 AM
  • I have 10000 word document and i want save  the contents in document in tables 

    and the table design is 

    id 

     content   ntext 

    docName  nvarchar(250)

    Okay.  Looks like you're using an arbitrary ID as the key, and docName is the filename, correct?

    Is there something specific you need help with?  Are you just looking for an example of how to read in a document and insert the byte-stream into the database, or are you having a particular problem?  What have you tried so far?  There are lots of examples on the web for inserting a file stream into a table in SQL Server, and various different methods of doing it that depend on your requirements.

    Other than that this post doesn't really seem to be a question.

    Thursday, June 18, 2015 12:35 PM
  • In what format do you want to save the content? I'm assuming that you don't want to lose formatting by simply extracting the content?

    Generally the whole file is streamed in its native format and then written to a column in a database table (varbinary) in order to avoid loss of formatting.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, June 18, 2015 2:01 PM
  • I have 10000 word document and i want save  the contents in document in tables 

    and the table design is 

    id 

     content   ntext 

    docName  nvarchar(250)

    Okay.  Looks like you're using an arbitrary ID as the key, and docName is the filename, correct?

    Is there something specific you need help with?  Are you just looking for an example of how to read in a document and insert the byte-stream into the database, or are you having a particular problem?  What have you tried so far?  There are lots of examples on the web for inserting a file stream into a table in SQL Server, and various different methods of doing it that depend on your requirements.

    Other than that this post doesn't really seem to be a question.

    Yea that is like I gave as first reply in this thread with a sample how to do that. The OP told however he does want the content. 

    Are you guys really giving only replies on the last shown message?


    Success
    Cor

    Thursday, June 18, 2015 2:16 PM
  • Yea that is like I gave as first reply in this thread with a sample how to do that. The OP told however he does want the content. 

    Are you guys really giving only replies on the last shown message?


    Success
    Cor

    Thursday, June 18, 2015 2:16 PM
  • Cor,

    I just wanted him to tell us what the difference is between saving the content and your example. In your example, you are streaming the content into the database, which is the correct method.

    The content is only relevant if it's saved in a particular format, which is usually the native document format.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thursday, June 18, 2015 2:23 PM
  • Please Write  Code In here 

    some people answer me by used Dll File

    Wednesday, October 7, 2015 9:58 AM