精华区 [关闭][返回]

当前位置:月光软件>>讨论区精华>>〖软件开发〗>>● ASP>>★ASP的技巧★>>组件开发及应用>>DLLImage(Very Helpful DLL)

主题:DLLImage(Very Helpful DLL)
发信人: gts()
整理人: dongbao(2002-04-19 16:38:48), 站内信件
Q. How do I store/retrieve text and image data in SQL Server? 
 
A. To store/retrieve this sort of data within TSQL scripts you have to
 use the WRITETEXT and READTEXT commands rather than standard INSERT/S
ELECT statements.  These are documented, with examples, in the books-o
nline but are basically a real pain to use.  There are more manageable
 commands available from within the relevant programming languages - e
.g. RDO and ADO from VB/C can use GetChunk and AppendChunk commands - 
but you still have to manage the image/text chunks/blocks of data at a
 time.  About the only upside of storing this sort of data within SQL 
Server is that it can be kept transactionally consistent with the othe
r data.  
 
For native ODBC access use the SQLPutData and SQLGetData commands. 
 
If you just want to insert/retrieve an entire image/text then look at 
the TEXTCOPY program (textcopy /? for parameters) in the <sql>\BINN di
rectory.  It is a command-line program along the lines of BCP.
 
There is a very useful (free) dll available from http://www.chriscrawf
ord.com/DBImage (courtesy of Chris Crawford).  It has three functions:
 
 
GetImage Used for getting an image from the database
StoreImage Used to send an image to the database
GetWebImage Used to send a DB image to a browser
 
If transactional consistency doesn't matter, or can be achieved progra
mmatically, then it is easier to store the data outside the database a
s an ordinary file.  Within the database just hold a UNC pointer to wh
ere the file is held.  This usually makes it much easier to display/ed
it the data as the name can simply be passed to whatever tool is doing
 the manipulation.

--
※ 来源:.月光程序代码网 http://www.moon-soft.com.[FROM: 202.106.21.78]

[关闭][返回]






转载请注明:转载自 月光程序代码网 [ http://www.moon-soft.com ]