What’s the easiest way to preview data from an image column?

后端 未结 6 1866
不知归路
不知归路 2020-12-14 08:59

I have some columns with image data type and I want to preview (or browse) the data in those tables. When I use Select top 1000 rows in SQL Server

6条回答
  •  渐次进展
    2020-12-14 09:12

    If you have LinqPad installed, previewing images is simple. Query your record, convert the binary data to an image, then dump the output to the preview window.

    Edit: If you aren't aware, LinqPad is a free utility that can be used for many things, such as a replacement for management studio. Most of the time I use it as a scratch pad for .Net for throw-away programs, test code, and samples.

    var entity = // fetch data
    
    using (var ms = new MemoryStream(entity.Image.ToArray()))
    {
        System.Drawing.Image.FromStream(ms).Dump();
    }
    

    Here's what the result looks like:

    enter image description here

提交回复
热议问题