Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a bug regarding retrieving the file which stored in database.
In my application, I need to save and retrieve the files. All the files are saving properly in a binary format, but coming to retrieving when i am trying to retrieve i’m getting the whole file as “system.Byte[]”. And wen iam trying to open it from browser window it is showing only “System.Byte[]”.
Posted
Updated 11-Aug-15 2:33am
v2

1 solution

The problem is how you are storing the information, not how you are retrieving it. You should never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.

It's exactly the same problem as described here: Why do I get a "Parameter is not valid." exception when I read an image from my database?[^] - and exactly the same solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900