请教: 声音、图象文件如何存储到数据库里并显示出来

最近在做档案管理信息系统,不知道声音、图象文件如何存储到数据库里并显示出来?以前没做过。
[44 byte] By [streaming-lingling] at [2008-2-13]
# 1
显示是什么意思?
use Northwind
go
create table testimg (a int,b image);
go
insert testimg (a,b) values (2,'test');
go
然后用textcopy工具来改内容
textcopy /S test /U sa /P /D Northwind /T testimg /C b /W "where a = 2" /F f:\1.jpg /I /Z

取图片到硬盘上:
textcopy /S test /U sa /P /D Northwind /T testimg /C b /W "where a = 2" /F f:\1.jpg /O /Z
sky_blue-蓝天2007 at 2007-10-20 > top of Msdn China Tech,MS-SQL Server,基础类...
# 2
要注意的是字段类型为text,not null default('')

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[InsertIntoFile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[InsertIntoFile]
GO

CREATE PROCEDURE dbo.InsertIntoFile
@SqlServer sysname ,
@Login varchar(255),
@Password varchar(255),
@Database sysname,
@Table sysname,
@Column sysname,
@Condition varchar(1000),
@FileName varchar(255),
@InOut char(1)
AS

DECLARE @strCmdString nvarchar(4000)

SET @strCmdString = 'textcopy '
+ ' /S ' + @SqlServer
+ ' /U ' + @Login
+ ' /P ' + @Password
+ ' /D ' + @Database
+ ' /T ' + @Table
+ ' /C ' + @Column
+ ' /W "' + @Condition + '" '
+ ' /F "' + @FileName + '" '
+ ' /' + @InOut
+ ' /K 40960 '
-- + ' /Z '
SELECT @strCmdString
EXEC master..xp_cmdshell @strCmdString

RETURN 0

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
anziqi-美洲狮 at 2007-10-20 > top of Msdn China Tech,MS-SQL Server,基础类...