First off, stop mixing styles and use parametrized queries throughout: concatenating strings is wide open to SQL injection attack which could damage or destroy your database. This may sovle your problem anyway.
Second, look at any error message you get via the
catch
- it should give you a clue as to what is wrong.
At the moment, there are far too many possibilities for error here, that we can't even begin to guess which one of they you have caused without better information.
string strQuery = "INSERT INTO property(name, email, phone, heading, description, location, image1, image2, image3, image4) VALUES(@NM, @EM, @PN, @HD, @DS, @LO, @D1, @D2, @D3, @D4)";
SqlCommand cmd = new SqlCommand(strQuery);
cmd.Parameters.AddWithValue("@NM", name);
cmd.Parameters.AddWithValue("@EM", email);
cmd.Parameters.AddWithValue("@PN", phone);
cmd.Parameters.AddWithValue("@HD", title);
cmd.Parameters.AddWithValue("@DS", description);
cmd.Parameters.AddWithValue("@LO", district);
cmd.Parameters.AddWithValue("@D1", bytes);
cmd.Parameters.AddWithValue("@D2", bytes2);
cmd.Parameters.AddWithValue("@D3", bytes3);
cmd.Parameters.AddWithValue("@D4", bytes4);
SqlConnection con = new SqlConnection(constr, con);
try
{
...