c# - What variable type should I use to save an image? -
I am going to save images in a SQL database (do not know what kind of use there), and I
what type of variable should I use to store this image?
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Text; Namespace Nana_s_Student_Gradebook {class student {The name of the public string {get; Set; } Public string lastName {get; Set; } Byte [] Picture {get; Set; } Public Date Time Offfall {Received; Set; }}}
Any guidance please? :)
On the SQL Server side, by all means, using a VARBINARY (MAX) Type
- it's binary, it's size up to 2 GB, it's fast, this is perfect for the case, up to an average image size of approximately 1 MB, this is probably your best bet - SQL Server 2008 is even better than using the FILESTREAM
attribute (which you have a really big image, bigger, bigger is 1 MB on a regular basis Here, the binary file itself is stored in the database of the server machine's file system in the database control.)
In your. NET code, you might see a image
or a derivative Classes - Finally, you have to stream those bytes from one side to the SQL server, or in some other form, but you do not have to use a byte array from the beginning - all the picture-related types in the .NET type The Tryming support.
Comments
Post a Comment