Hello @natsit kaewsungharn
Not knowing how you interact with data let' say it's via a SqlClient connection and command using a where condition uniqueidentifier maps to a string so you can pass a string to represent a uniqueidentifier. Then in your SELECT place the column name for the picture in. Or via Entity Framework similarly use a .Where and .Select.
In either case the picture is a byte array, depending on the column type, image or varbinary(max) you can return a image using the following code by passing in the byte array. If using .NET Core then you need the NuGet package System.Drawing.Common.
public class ImageHelpers
{
// for image column
public static Image ByteArrayToImage1(byte[] contents)
{
using (var ms = new MemoryStream(contents))
{
return Image.FromStream(ms);
}
}
// for varbinary(max)
public static Image ByteArrayToImage(byte[] contents)
{
var converter = new ImageConverter();
var image = (Image)converter.ConvertFrom(contents);
return image;
}
}