本文介绍了LightSwitch无法打开C#存储在SQL数据库(varbainary(max))中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将图像存储在SQL数据库中以便可以被Lightswitch开发的应用程序读取的正确方法是什么?即使在格式(varbainary(max))下,我在LightSwitch中的应用程序也无法打开SQL中存储的图像.

困难不是格式本身...据我在互联网上发现的(例如:在LightSwitch中的Image字段类型上),当通过C#开发的程序将图片存储在SQL数据库中时,将在其中添加一个代码段(标头OLE)以及image字段(varbainary(max))数据库.

PS:图像以lightswitch所使用的DB SQL格式varbinary(max)存储.

What is the correct way to store an image in a SQL database so that it can be read by applications developed in Lightswitch? My application in LightSwitch can not open the images stored in SQL, even if the format (varbainary (max)).

The difficulty is not the format itself ... From what I found on the internet (ex:On Image field type in LightSwitch), when a picture will be stored in the SQL database through a program developed in C #, a snippet (Header OLE) is added along with the image field (varbainary (max) ) in the database.

PS: The image is being stored in my DB SQL format varbinary (max), as used by lightswitch.

推荐答案

  1. 在LightSwitch中添加指向带有表的数据库的数据源.
  2. 双击具有VarBinary的表在LightSwitch中的条目.
  3. 在类型"字段中您的VarBinary列,将设置从Binary更改为Image

将表格添加到屏幕并进行测试.

Add the table to a screen and test.

在我的示例中,我能够轻松地将图片添加到我选择向其添加varbinary列的表中.

In my sample, I was able to easily add pictures to the table I chose to add a varbinary column to.


这篇关于LightSwitch无法打开C#存储在SQL数据库(varbainary(max))中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 15:28