bytestowrite

How to retrieve file from database?

只愿长相守 提交于 2021-01-29 04:07:57
问题 I have saved a file in a database by converting it in bytes. It is saved successfully but I am unable to retrieve it. Here is code which I used to convert and save: public static void databaseFilePut(string varFilePath) { byte[] file; using (var stream = new FileStream(varFilePath, FileMode.Open, FileAccess.Read)) { using (var reader = new BinaryReader(stream)) { file = reader.ReadBytes((int)stream.Length); } } using (SqlConnection varConnection = new SqlConnection("Data Source=FARHANB