如何将图像从SQL附加到C#.net [英] how to fatch image from SQL to c# .net
本文介绍了如何将图像从SQL附加到C#.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友
我已使用以下代码将图像插入SQL Server:
- ---------------- ----------------
创建 TABLE 员工
(
ID int ,
名称 varchar ( 50 )不是 空,
图片 varbinary (最大值)不是 空
)
插入 INTO 员工(身份证,姓名,照片)
选择 10 ,' John',BulkColumn
FROM Openrowset (批量 ' D:\ logo.bmp',Single_Blob)为员工图片
- ------------------------ ----
现在我想在C#GUI的图片框中显示它.请帮助我将图像从SQL附加到GUI.这段代码的主要目的是,当我在SQL中更新新映像时,我想在GUI中对其进行更改,因为它的链接来自SQl.
在此先谢谢您.
解决方案
请参阅此CP文章:
在C#中向Microsoft SQL发送/接收PictureBox图像服务器 [ ^ ]
通过简单的搜索 ^ ]
Dear Friends
I have insert image into SQL server using following code:
----------------------------------
CREATE TABLE Employees
(
Id int,
Name varchar(50) not null,
Photo varbinary(max) not null
)
INSERT INTO Employees (Id, Name, Photo)
SELECT 10, 'John', BulkColumn
FROM Openrowset( Bulk 'D:\logo.bmp', Single_Blob) as EmployeePicture
------------------------------
Now i want to show it in picture box in C# GUI . Please help me to fatch image from SQL to GUI . The main purose of this code is that i want when i update new image in SQL then it should be changed in GUI because its link from SQl.
Thanks in advance.
解决方案
See this CP article:
Sending/Receiving PictureBox Image in C# To/From Microsoft SQL SERVER[^]
Found it on a simple search here[^]
这篇关于如何将图像从SQL附加到C#.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文