我想读取SQLServer2000的Northwind数据库里Categories表的picture
但我用绑定,存为临时文件都不行,请问我该怎样读取哪幅图片呢~?用Access 2000里打开"罗斯文示例数据库",他能正确读出类别图片~~~

解决方案 »

  1.   

    --查询分析器中,用下面的方法导出就可以保证导出标准的图片文件declare @id int,@fn nvarchar(260),@tmpfn nvarchar(260)
    select @id=2 --要导出的employeeid
    ,@fn='c:\test.bmp' --导出生成的文件名
    ,@tmpfn='c:\tmp.bak' --导出过程中使用的临时文件名--生成临时表,控制取消图片数据中的前缀
    create table ##tb(img image)
    insert into ##tb
    select photo=picture from northwind..Categories where Categoryid=@id--删除前缀处理
    declare @p varbinary(16)
    select @p=textptr(img) from ##tb
    updatetext ##tb.img @p 0 78 null--导出数据
    declare @sql varchar(8000)
    set @sql='bcp "select * from(select null as 类型 union all select 0 as 前缀 union all select 0 as 长度 union all select null as 结束 union all select null as 格式) a" queryout "'
    +@tmpfn+'" /c /S"zj" /P""'
    exec master..xp_cmdshell @sql,no_outputset @sql='bcp ##tb out "'+@fn+'" /S"zj" /P"" /i"'+@tmpfn+'"'
    exec master..xp_cmdshell @sql,no_outputset @sql='del '+@tmpfn
    exec master..xp_cmdshell @sql,no_output
    go
    drop table ##tb
      

  2.   

    zjcxc(邹建) :怪不得前两天作Access的图片时有些问题!问题原来在这里! thx
      

  3.   

    http://community.csdn.net/Expert/topic/3436/3436720.xml?temp=.1255915
      

  4.   

    都是“猩猩”! 各位老大们手头上有没有好的学习资料,存到我硬盘如何?!
    在csdn上东看一点,西看一点,头好晕啊!