如何在SQL Server中将图像插入nvarchar(max)

时间:2018-01-09 01:21:43

标签: asp.net sql-server

我正在关注MVC 5教程:http://www.c-sharpcorner.com/article/dashboard-application-with-asp-net-mvc-5-and-jquery/

其中作者具有代码优先迁移,该迁移创建一个表(以及其他表),其中CustomerImage列在SQL Server中变为nvarchar(max)。他没有“播种”它,也没有说明他是如何填充桌子的。他的演示应用程序显示图像就好了。

我使用SQL插件填充我的表格版本:

  INSERT [dbo].[Customer]
  (
    CustomerName
    ,CustomerEmail
    ,CustomerPhone
    ,CustomerCountry
    ,CustomerImage
 )
 VALUES
 (
   'Person 1'
   ,'Person1@hotmail.com'  
   ,'(203) 111-1111'
   ,'USA'
   ,(SELECT * FROM OPENROWSET(BULK N'C:\First\Images\Person1.jpg', 
    SINGLE_BLOB) as CustImage) 
 )

但我的部分视图中没有显示我的图片。

我的插页不正确吗?

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

0 个答案:

没有答案