title: How can i make nulleable Byte[]
body: <p>Hi everyone I can't take a null value for my image property I have this error:</p>
  
  <blockquote>
    <p>Implicit conversion from data type nvarchar to varbinary(max) is not allowed. use the convert function to run this query.</p>
  </blockquote>
  
  <p>This is my prop class:</p>
  
  <pre><code>namespace testhopital
  {
      using System;
      using System.Collections.Generic;
      using System.ComponentModel.DataAnnotations;
      using System.ComponentModel.DataAnnotations.Schema;
  
      public partial class UserProfile
      {
          public UserProfile()
          {
              this.webpages_Roles = new HashSet&lt;webpages_Roles&gt;();
          }
  
          public int UserId { get; set; }
          [Display(Name = "User name")]
          public string UserName { get; set; }
          [Required]
          [Display(Name = "Prenom")]
          public string UserSurname { get; set; }
           [Display(Name = "Email")]
          public string UserEmail { get; set; }
          [Display(Name = "Date Naissance")]
          [DataType(DataType.Date)]
          public Nullable&lt;System.DateTime&gt; UserBirthday { get; set; }
          [Column(TypeName = "image")]
          [Display(Name = "Votre Photo")]
          public byte[] UserPicture { get; set; }
           [Display(Name = "Adresse")]
          public string UserAdress { get; set; }
          [Display(Name = "numero de tlephone")]
          public string UserPhone { get; set; }
            [Display(Name = "Description")]
          public string UserDescription { get; set; }
          [Display(Name = "Date de creation")]
          public Nullable&lt;System.DateTime&gt; UserCreateAcount { get; set; }
  
          [Display(Name = "Date de modification")]
          public Nullable&lt;System.DateTime&gt; UserLastUpdate { get; set; }
          public Nullable&lt;int&gt; RoleId { get; set; }
          [Required]
          [Display(Name = "User password")]
          [DataType(DataType.Password)]
          public string password { get; set; }
  
          [Required]
          [Display(Name = "Confirm password")]
          [Compare("password", ErrorMessage = "mot de passe pas valider")]
          [DataType(DataType.Password)]
          public string confirmPassword { get; set; }
  
          public virtual ICollection&lt;webpages_Roles&gt; webpages_Roles { get; set; }
          public virtual webpages_Roles webpages_Roles1 { get; set; }
      }
  }
  </code></pre>
  
  <p>and my controller:</p>
  
  <pre><code>  [HttpPost]
      public ActionResult Register(UserProfile register, HttpPostedFileBase image2)
      {
  
  
          if (ModelState.IsValid)
          {
  
              try
              {
                  register.UserPicture = new byte[image2.ContentLength];
                  image2.InputStream.Read(register.UserPicture, 0, image2.ContentLength);
  
              }
              catch (Exception)
              {
  
                  register.UserPicture = null;
              }
  
              WebSecurity.CreateUserAndAccount(register.UserName, register.password, new
                            {
  
                                UserSurname = register.UserSurname,
                                UserEmail = register.UserEmail,
                                UserBirthday = register.UserBirthday,
  
                                UserPicture = register.UserPicture,
                                UserAdress = register.UserAdress,
                                UserPhone = register.UserPhone,
                                UserDescription = register.UserDescription,
                                UserCreateAcount = DateTime.Now,
  
  
                            },true);
  
              return RedirectToAction("Login", "AccountHopital");
          }
          return View(register);
  
      }
  </code></pre>
  
  <p>I have error if I make a null Image.
  I need to make image to null value not a byte[0]</p>