First issue you have is you are using ExecuteScalar. ExecuteScalar returns the first 2033 characters only - refer to MSDN;
SqlCommand.ExecuteScalar Method ()[
^]
Best option is to return a Datatable/DataSet that contains your data.
Then the code I use which works in IE & Chrome is as follows;
byte[] bytFile = (byte[])dataTable.Rows[0][VarbinaryFieldName];
this.Context.Response.ContentType = "\".pdf\",\"application/pdf\"";
this.Context.Response.AddHeader("Content-disposition","attachment; filename=filename.pdf");
this.Context.Response.BinaryWrite(bytFile);
Response.End();
Kind Regards