title: DataTable with DateTime Column throws "Conversion failed when converting date and/or time"
body: <p>I am trying to call a stored procedure that accepts a Table Value Parameter with one string and one date time column.</p>
  
  <p>Stored Proc</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[uspStoredProcedureDateTimeTableValueTest]
  -- Add the parameters for the stored procedure here
  @Param DateTimeType READONLY
  AS
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  
  
  END
  </code></pre>
  
  <p>TVP:</p>
  
  <pre><code>CREATE TYPE DateTimeType AS TABLE 
  (
      Name nvarchar(50),
      ModifiedDate datetime
  )
  </code></pre>
  
  <p>.NET Console app:</p>
  
  <pre><code>    static void Main(string[] args)
      {
          string connectionString = ConfigurationManager.ConnectionStrings["default"].ConnectionString;
          using (SqlConnection connection = new SqlConnection(connectionString))
          {
              connection.Open();
  
              DataTable table = new DataTable("Test");
              table.Columns.Add("ModifiedDate", typeof(DateTime));
              table.Columns.Add("Name", typeof(string));
  
              DataRow row = table.NewRow();
              row["Name"] = "David";
              row["ModifiedDate"] = DateTime.Now;
              table.Rows.Add(row);
  
              SqlCommand command = new SqlCommand("uspStoredProcedureDateTimeTableValueTest", connection);
              command.CommandType = CommandType.StoredProcedure;
              command.Parameters.AddWithValue("@Param", table);
  
              command.ExecuteNonQuery();
          }
      }
  </code></pre>
  
  <p>Whenever I try to execute this SP from .NET I am getting an error:</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.Data.SqlClient.SqlException'
    occurred in System.Data.dll</p>
    
    <p>Additional information: Conversion failed when converting date and/or
    time from character string.</p>
    
    <p>The data for table-valued parameter "@Param" doesn't conform to the
    table type of the parameter. SQL Server error is: 241, state: 1</p>
    
    <p>The statement has been terminated.</p>
  </blockquote>
  
  <p>It seems to work when I only have the DateTime parameter. But adding the additional 'Name' parameter has apparently caused some problems.  What am I doing wrong?</p>