My question is the continuation of this question: Link to another question
I was able to transform my file into bytes and insert it inside a table in SQL Server, however now I want from within an application that I'm doing in C # I want to open this file. That is to reverse engineer (byte > open the file).
The code used for insertion:
Anexo a = new Anexo();
FileStream fs = new FileStream(a.Caminho, FileMode.Open, FileAccess.Read);
a.Arquivo = new byte[fs.Length];
fs.Read(a.Arquivo, 0, System.Convert.ToInt32(fs.Length));
string SQL = @"INSERT INTO ANEXO (NOME, CAMINHO, ARQUIVO) VALUES (@nome, @caminho, @arquivo)";
Cmd = new SqlCommand(SQL, Con);
Cmd.Parameters.Add("@nome", SqlDbType.VarChar).Value = a.NomeArquivo;
Cmd.Parameters.Add("@caminho", SqlDbType.VarChar).Value = a.Caminho;
Cmd.Parameters.Add("@arquivo", SqlDbType.VarBinary).Value = a.Arquivo;
Cmd.ExecuteNonQuery();