Search code examples
c#wpfsave-image

WPF: How to save image in SQL Server type as image?


I'm trying to save an image to the database (SQL Server) using WPF. Every solution on web is for WinApp.

I can't find some className or namespace in theirs.

Please help me!

Thanks.


Solution

  • I don't think there is an explicit "image" type in sql server. If you want to store your image in sql server you can store it as binary using the varbinary type: https://learn.microsoft.com/en-us/sql/connect/jdbc/using-advanced-data-types?view=sql-server-ver15 However, I think the most common solution to storing images might be to use some other sort of file storage, and just store the url to where the image is stored in the sql database.