Adding a file:
You will need to use the
System.Windows.Forms.OpenFileDialog
to select the file, then load that into a byte array. Standard code to load it to a byte array would be something like:
if (File.Exists(filename)) {
FileInfo finfo = new FileInfo(filename);
FileStream fstream = new FileStream(filename, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fstream);
byte[] data = br.ReadBytes(Convert.ToInt32(finfo.Length));
br.Close();
fstream.Close();
fstream.Dispose();
}
You should store this in a column of type
VarBinary(Max)
.
To review it, just reverse the process, saving the file to a temp location and calling
Process.Start(<myfilename>)
to open it.
Deleting it is obvious.