如何将图像插入数据库? [英] How To Insert An Image In To Database ?

查看:97
本文介绍了如何将图像插入数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sql server 2008 R2。



我需要通过sql cmd插入图片吗?



我的表结构是

I am using sql server 2008 R2.

I need to insert an image through sql cmd ?

my table structure is

SELECT TOP 1000 [AddressID]
[Image]
FROM [xxx].[dbo].[tblAddress]





如何插入图片,其中AddressID ='1'?



how can i insert an image where AddressID='1' ?

推荐答案

你甚至谷歌?



在SQL Server中存储或保存图像 [ ^ ]



请使用提供的搜索工具。



这些是新帖子的规则。发布问题就在那里

发布问题时的一些简单规则。

礼貌。这里的每个人都有帮助,因为他们喜欢帮助,而不是因为这是他们的工作。

您是否搜索过或搜索过Google?

具体!例如如何更改对话框颜色?而不是我的代码不起作用。帮助?

适当标记你的问题。

如果你有学校或大学的任务,假设你的老师或讲师是也阅读这些论坛。

如果其他人回复,请不要删除或清空消息。
do you even google?

Store or Save images in SQL Server[^]

Please use the search facilities provided.

These are the rules for new posts. It's right there when you post a question
A few simple rules when posting your question.
Be courteous. Everyone here helps because they enjoy helping, not because it's their job.
Have you searched or Googled for a solution?
Be specific! eg "How do I change the dialog colour?" instead of "My code doesn't work. Help?"
Tag your question appropriately.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
Do not remove or empty a message if others have replied.


请尝试以下查询

Please try following query
UPDATE [dbo].tblAddress Set [Image] =
(SELECT MyImage.* from Openrowset(Bulk
'C:\Image.bmp', Single_Blob) MyImage)
Where AddressID=1







欲了解更多信息,请查看以下链接



< a href =https://msdn.microsoft.com/en-us/ library / ms190312.aspx> https://msdn.microsoft.com/en-us/library/ms190312.aspx [ ^ ]



https://technet.microsoft.com/en-us/library/Aa276850%28v=SQL.80%29。 aspx [ ^ ]



https://www.mssqltips.com/sqlservertip/1643/using-openrowset-to-read-large-files-into-sql-server/ [< a href =https://www.mssqltips.com/sqlservertip/1643/using-openrowset-to-read-large-files-into-sql-server/target =_ blanktitle =New Window> ^ ]



问候,

Manoj




For more please check following links

https://msdn.microsoft.com/en-us/library/ms190312.aspx[^]

https://technet.microsoft.com/en-us/library/Aa276850%28v=SQL.80%29.aspx[^]

https://www.mssqltips.com/sqlservertip/1643/using-openrowset-to-read-large-files-into-sql-server/[^]

With Regards,
Manoj


这篇关于如何将图像插入数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆