Connecting Tech Pros Worldwide Forums | Help | Site Map

Storing and Retreiving SQL2K BLOBS

David Beck
Guest
 
Posts: n/a
#1: Nov 21 '05
I have a need to store PDF, TIF and other files in TEXT fields on my
SQL2000 Server and them retreive them and restore them to the disk
(VB6). I created a table

CIP_DOCUMENT_ID int no 4 10 0 no (n/a)
(n/a) NULL
NAME varchar no 255 no no no
SQL_Latin1_General_CP1_CI_AS
BODY text no 16 no (n/a) (n/a)
SQL_Latin1_General_CP1_CI_AS

And wrote code to read the binary contents of a file into a varient. I
then stored the contents of the varient into the TEXT field (BODY). When
I reverse the process, the data is incorrect. Can someone show me a code
stub for doing this or point me in the right direction?

Dab

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

David R. Jenkins
Guest
 
Posts: n/a
#2: Nov 21 '05

re: Storing and Retreiving SQL2K BLOBS


David,
You should make your "BODY" field a data type of "Image".

I also found this Q article on Microsoft's web-site in case you need
some additional reference material:

http://support.microsoft.com/default...b;en-us;316887
Hope this helps,
David R. Jenkins

Cor Ligthert
Guest
 
Posts: n/a
#3: Nov 21 '05

re: Storing and Retreiving SQL2K BLOBS


David,

In addidition to David, for storing and writting a Blob file to a SQL server
I have a lot of samples.

However all VBNet. (What is as well for the sample of David showed on MSDN)

For VB6 there are other newsgroups. All starting with
microsoft.public.vb

I think that beside of the Image answer from David you can get there easier
an answer on your question how to access that.

Just a little addition.

Cor

"David Beck" <davidb@beckb.com> >I have a need to store PDF, TIF and other
files in TEXT fields on my[color=blue]
> SQL2000 Server and them retreive them and restore them to the disk
> (VB6). I created a table
>
> CIP_DOCUMENT_ID int no 4 10 0 no (n/a)
> (n/a) NULL
> NAME varchar no 255 no no no
> SQL_Latin1_General_CP1_CI_AS
> BODY text no 16 no (n/a) (n/a)
> SQL_Latin1_General_CP1_CI_AS
>
> And wrote code to read the binary contents of a file into a varient. I
> then stored the contents of the varient into the TEXT field (BODY). When
> I reverse the process, the data is incorrect. Can someone show me a code
> stub for doing this or point me in the right direction?
>
> Dab
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]


David R. Jenkins
Guest
 
Posts: n/a
#4: Nov 21 '05

re: Storing and Retreiving SQL2K BLOBS


Cor,
Could you post your samples? I'd be interested in seeing them!
Regards,
David R. Jenkins

Cor Ligthert
Guest
 
Posts: n/a
#5: Nov 21 '05

re: Storing and Retreiving SQL2K BLOBS


David,

This is my standard format for that for a windowform, when you need someting
like this for a webform or a webservice tell that than. (In the webservice
sample I have also the sample how to overcome the ole format and using a
thumbnail)

http://groups.google.com/groups?selm...TNGP11.phx.gbl

In this sample I have tried as much as possible to avoid the memorystream
(although it is in this sample as well)

I hope this helps?

Cor

"David R. Jenkins" <jenksman@gmail.com>
[color=blue]
> Cor,
> Could you post your samples? I'd be interested in seeing them!
> Regards,
> David R. Jenkins
>[/color]


David R. Jenkins
Guest
 
Posts: n/a
#6: Nov 21 '05

re: Storing and Retreiving SQL2K BLOBS


Thanks for posting the link! I am always interested in looking at the
way others write code. I find that it helps me improve my ways of
coding by seeing others work.

Thanks again!

Closed Thread