Check your table:
string query = "insert into tblfiles values (@Name, @ContentType, @Data)";
using (SqlCommand cmd = new SqlCommand(query))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Name", filename);
cmd.Parameters.AddWithValue("@ContentType", contentType);
cmd.Parameters.AddWithValue("@Data", bytes);
You are providing three values, without specifying where they are to go - and there are more than three or less than three columns in your table.
Probably, it's simple to fix: always name the columns you are inserting into in your SQL
string query = "insert into tblfiles (UseName, Content, Data) values (@Name, @ContentType, @Data)";
using (SqlCommand cmd = new SqlCommand(query))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Name", filename);
cmd.Parameters.AddWithValue("@ContentType", contentType);
cmd.Parameters.AddWithValue("@Data", bytes);
And it will only try to insert to those columns. If you don't tell it where to put things, it assumes you want them in numerical order - so if you have a column you don't need to supply a value for at the start (an Identity field for example, or a field that can be null) it will try to put your values in that.
Always specify columns: that way your code doesn't fall over in someone changes the database columns order next month!