title: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM
body: <p>I can't seem to find the right answer in other questions like this.</p>
  
  <p>I'm using this piece of code to assign the date that should be saved in the database.</p>
  
  <pre><code>request.BranchRequestDate = DateTime.Now;
  </code></pre>
  
  <p>And when I'm trying to retrieve the data from the table using this function.</p>
  
  <pre><code>public Request SelectByID()
      {
          try
          {
              SqlCommand command = this.GetParametizedCommand("SELECT * FROM Request WHERE RequestUID = '" + this.RequestUID.ToString() + "' ;");
              command.CommandType = CommandType.Text;
              SqlDataAdapter adapter = new SqlDataAdapter(command);
              DataTable tbl = new DataTable();
              adapter.Fill(tbl); //This is where the exception is thrown
              return ToEntity(tbl);
          }
          catch
          {
              return null;
          }
  
      }
  </code></pre>
  
  <p>...It throws and exception.</p>
  
  <p>I've tried checking everything, but what I can't figure out is why it throws and exception, as I can't see what the retrieved data looks like in C#, but I've tried the statement in SQL Server itself and it returns the correct data.</p>
  
  <p>Any idea?</p>
  
  <p>EDIT: I have also compared it with a similar function in the same program, and it functions just fine.</p>
  
  <p>EDIT:
  Code for GetParametizedCommand method</p>
  
  <pre><code>public SqlCommand GetParametizedCommand(String commandText)
      {
          try
          {
              SqlCommand command = base.GetSqlCommand(commandText);
              if(SavingStatus == Util.SavingStatus.INSERT)
                  command.Parameters.Add(new SqlParameter("@RequestUID", SqlDbType.Int,32, ParameterDirection.Output, false, 38, 38, "RequestUID", DataRowVersion.Default, this.RequestUID));
              else if (SavingStatus == Util.SavingStatus.UPDATE || SavingStatus == Util.SavingStatus.DELETE)
                  command.Parameters.Add(new SqlParameter("@RequestUID", SqlDbType.Int,32, ParameterDirection.Input, false, 38, 38, "RequestUID", DataRowVersion.Default, this.RequestUID));
              command.Parameters.AddWithValue("@DisplayID", this.DisplayID);
              command.Parameters.AddWithValue("@BranchUID", this.BranchUID);
              command.Parameters.AddWithValue("@EmployeeUID", this.EmployeeUID);
              command.Parameters.AddWithValue("@BranchRequestDate", this.BranchRequestDate);
              command.Parameters.AddWithValue("@IsDeleted", this.IsDeleted);
              return command;
          }
          catch
          {
              return null;
          }
  
      }
  </code></pre>