473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Open binary file directly from BLOB

Hi,

Can someone suggest the best technique / method of opening a Word ( or any
other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field to a
binary disk file and can then open it. It would be better for them to be
able to just open the file directly for viewing etc. I can 'trigger' a load
for the file myself, but Im sure there must be a 'slick' method using some
sort of 'memory' files, without needing to explicitly write the file to
disk first ?

One Issue I can forsee is determining the application required to open the
file. Also what would happen if the user modified and tried to save it ? Or
do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon
Aug 7 '06 #1
4 5074
Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that, then
you can feed the contents into Word from memory. However, you would have to
manage when it is saved (since there is no option in Word to save the file
to memory, only to disk), calling the Save method on the IPersistMemory
interface yourself when you wanted to commit the contents back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bishman" <jo*************@btinternet.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
Hi,

Can someone suggest the best technique / method of opening a Word ( or any
other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field to
a binary disk file and can then open it. It would be better for them to be
able to just open the file directly for viewing etc. I can 'trigger' a
load for the file myself, but Im sure there must be a 'slick' method using
some sort of 'memory' files, without needing to explicitly write the file
to disk first ?

One Issue I can forsee is determining the application required to open the
file. Also what would happen if the user modified and tried to save it ?
Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon

Aug 7 '06 #2
Thanks ( again ) Nicholas

Shame there is nothing 'slicker' but then its good in one way as its less
for me to code !!

Cheers for the response

Jon
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that, then
you can feed the contents into Word from memory. However, you would have
to manage when it is saved (since there is no option in Word to save the
file to memory, only to disk), calling the Save method on the
IPersistMemory interface yourself when you wanted to commit the contents
back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bishman" <jo*************@btinternet.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
>Hi,

Can someone suggest the best technique / method of opening a Word ( or
any other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field
to a binary disk file and can then open it. It would be better for them
to be able to just open the file directly for viewing etc. I can
'trigger' a load for the file myself, but Im sure there must be a 'slick'
method using some sort of 'memory' files, without needing to explicitly
write the file to disk first ?

One Issue I can forsee is determining the application required to open
the file. Also what would happen if the user modified and tried to save
it ? Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon


Aug 7 '06 #3
Bishman,

Maybe it will be easy to handle if you leave those Word files to the OS and
keep a link in DB.

chanmm

"Bishman" <jo*************@btinternet.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Thanks ( again ) Nicholas

Shame there is nothing 'slicker' but then its good in one way as its less
for me to code !!

Cheers for the response

Jon
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP04.phx.gbl...
>Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that,
then you can feed the contents into Word from memory. However, you would
have to manage when it is saved (since there is no option in Word to save
the file to memory, only to disk), calling the Save method on the
IPersistMemory interface yourself when you wanted to commit the contents
back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bishman" <jo*************@btinternet.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
>>Hi,

Can someone suggest the best technique / method of opening a Word ( or
any other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field
to a binary disk file and can then open it. It would be better for them
to be able to just open the file directly for viewing etc. I can
'trigger' a load for the file myself, but Im sure there must be a
'slick' method using some sort of 'memory' files, without needing to
explicitly write the file to disk first ?

One Issue I can forsee is determining the application required to open
the file. Also what would happen if the user modified and tried to save
it ? Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon



Aug 8 '06 #4
Yeah, I have seen other people advise this as well and its a fair
point.....to which I dont really have a particuarly strong response other
than the DB gets treated with a degree of respect from the backup and
security point of view, and it does provide that almost 'physical ' link
between the rest of the data associated with the BLOB and the BLOB itself.
"chanmm" <ch*****@hotmail.comwrote in message
news:eH**************@TK2MSFTNGP06.phx.gbl...
Bishman,

Maybe it will be easy to handle if you leave those Word files to the OS
and keep a link in DB.

chanmm

"Bishman" <jo*************@btinternet.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>Thanks ( again ) Nicholas

Shame there is nothing 'slicker' but then its good in one way as its less
for me to code !!

Cheers for the response

Jon
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that,
then you can feed the contents into Word from memory. However, you
would have to manage when it is saved (since there is no option in Word
to save the file to memory, only to disk), calling the Save method on
the IPersistMemory interface yourself when you wanted to commit the
contents back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bishman" <jo*************@btinternet.comwrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
Hi,

Can someone suggest the best technique / method of opening a Word ( or
any other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL
Binary field working fine, but the user 'saves' the file from the
Binary field to a binary disk file and can then open it. It would be
better for them to be able to just open the file directly for viewing
etc. I can 'trigger' a load for the file myself, but Im sure there must
be a 'slick' method using some sort of 'memory' files, without needing
to explicitly write the file to disk first ?

One Issue I can forsee is determining the application required to open
the file. Also what would happen if the user modified and tried to save
it ? Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon



Aug 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Palmieri | last post by:
Im using md5 to encrypt and decrypt plain text, this works fine... When i try to run the same function on a binary file, it does not decrypt correctly. Is there a way to encrypt binary files...
3
by: David Stockwell | last post by:
Hi, I'd like to read the contents of a file into memory. The problem is that this file is binary. I then want to store the whole thing in memory to a database as a blob. I have no problem...
1
by: Rune Hansen | last post by:
I'm storing gzipped data in a MySQL blob field. I can fetch the blob and "wb" write the data to a file. It becomes a file containg gz data. I can't take the same data and do anything sensible...
10
by: Peter Stojkovic | last post by:
I want store an integer-array of 1000 Values in a blob in a SQL-database. I will do this every 10 Seconds. How can I do this ???? What datatypes a have to use ??? Thanks
0
by: Wescotte | last post by:
I'm abit confused on how to work with binary data with an ODBC connection (My database is DB2 btw) Say I have a table like CREATE TABLE EJWLIB.BLOBTEST ( ID NUMERIC(5) NOT NULL, FILENAME...
21
by: Mike | last post by:
Hi, The example below shows that result of a marshaled data structure is nothing but a string >>> data = {2:'two', 3:'three'} >>> import marshal >>> bytes = marshal.dumps(data) >>>...
2
by: Bill Nguyen | last post by:
I need sample code to insert binary file (mappoint map file) into a varbinary column using VB.NET. Please help! Thanks Bill
7
by: Rudi Menter | last post by:
Hi, I would like to store binary data (as data-type blob) in a (MySql-) database, so I require functionality that allows a mapping from and back into the filesystem. Now, is there a library for...
7
by: lawrence k | last post by:
I've got a music studio for a client. Their whole studio is run with Macintosh computers. Macintosh computers allow file names to have open white spaces, such as "animal hospital.mp3". I have a...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.