![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Sep 2004
Posts: 42
Rep Power: 0
![]() |
Saving document into database
I'm looking for help on how to save .doc and .pdf documents into a database, and then after that, be able to retrieve the text into a textbox.
I've read around, and saw it can be done by converting the document into a binary data type, but I have no idea how this can be done. I'm using ASP with C# and SQL Server 2005. Please Help |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
Re: Saving document into database
Why don't you just store the files on the server and put in the path in the database?
|
|
|
|
|
|
#3 |
|
Not a user?
Join Date: Sep 2007
Posts: 245
Rep Power: 1
![]() |
Re: Saving document into database
Then if the file should get moved?
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
Re: Saving document into database
If the file gets moved then you either make a program to move it that will also update the database or you update the database on your own.
|
|
|
|
|
|
#5 | |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Re: Saving document into database
Quote:
What you need to do is write a script to insert a text file into a column. However, there are two changes you need to make apart from that routine process. 1) Make that column type "BINARY". BINARY(M) The BINARY type is similar to the CHAR type, but stores binary strings rather than non-binary strings. This type was added in MySQL 4.1.2. 2) When you are reading in the PDF document, make sure your read handle is opened with the "rb" (read binary) format, rather than the typical "r" or "rt" (read text) format. Getting back on track, you said you want to retrieve the document from the database, and display it in a textbox. If you're using a textbox to display the output, then you don't want the binary. It seems you just want the text. You might need to find some .doc and .pdf libraries that could do the processing and plaintext fetching for you. But converting a fully formatted document with pictures and a layout, into simple plaintext, is a very difficult task. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Storing BLOBs in a database - problem | jonyzz | Other Programming Languages | 8 | Jan 31st, 2007 4:38 AM |
| searching an access database? | designXperts.net | Visual Basic .NET | 12 | Nov 27th, 2005 5:03 PM |
| Saving data to a database | a02227 | Visual Basic .NET | 2 | Apr 21st, 2005 2:35 AM |
| Using ODBC to connect to a remote database in a C program | bigi | C++ | 1 | Mar 8th, 2005 3:19 PM |