A *.rar file was saved in a column longblob
, but it was saved as bin开发者_StackOverflowary.
How can I build this file in vb.net?
For example I download its binary code with below query.
Select file from table where id=1
Then do I save it on a variable string? What is the best way for rebuild this .rar?
Once you have selected the field, cast the return object into byte[], and do what you need with it. If you need to send it to a user, through the browser, simple set mime type and filename, and write the byte[] to the outputstream. This is how I would do it, but with C# code:
context.Response.ContentType = ReturnExtension(Extension);
context.Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName);
byte[] buffer = (byte[])DB.GetReposFile(id).Rows[0]["FileContent"];
context.Response.OutputStream.Write(buffer, 0, buffer.Length);
精彩评论