title: Inserting null value into DateTime field using DBValue.null
body: <p>Next code is giving me an exception:</p>
  
  <pre><code>cmd.CommandText = @"insert Table ";
  cmd.CommandText += @"(StartTime,
                        EndTime)
                 values(@StartTime,
                        @EndTime)
                        SELECT CAST(scope_identity() AS int)";
  cmd.Parameters.AddWithValue ( "@StartTime", DBNull.Value );
  cmd.Parameters.AddWithValue ( "@EndTime", DBNull.Value );
  cmd.ExecuteScalar();
  </code></pre>
  
  <p>The exception I am getting is <code>Must declare '@StartTime' variable</code> and same thing for <code>@EndTime</code>. Isn't the <code>DBNull.Value</code> used for things like this, what am I doing wrong?</p>