Milliseconds not showing in SQL output for DateTime type
<p>I am having a problem seeing the millisecond component of a <code>DATETIME</code> type column.</p>

<p>The code that defines the table is: </p>

<pre><code>string command = string.Format("CREATE TABLE {0}(EventDateTime DATETIME, layer3Id VARCHAR(35), EventType VARCHAR(55), Protocol VARCHAR(30), MessageBody VARCHAR(MAX), MessageContent VARCHAR(MAX))", tableName);
SendSqlCommand(command);
</code></pre>

<p>The code that populates the row is : </p>

<pre><code>string insertCommand = string.Format(@"INSERT INTO {0} VALUES (@p1, @p2, @p3, @p4, @p5, @p6)", tablename);

_con.Open();

using (SqlCommand cmd = new SqlCommand(insertCommand, _con))
{
    cmd.Parameters.AddWithValue("@p1", record.EventDateTime);
    cmd.Parameters.AddWithValue("@p2", record.layer3Id);
    cmd.Parameters.AddWithValue("@p3", record.EventType);
    cmd.Parameters.AddWithValue("@p4", record.Protocol);
    cmd.Parameters.AddWithValue("@p5", record.MessageBody);
    cmd.Parameters.AddWithValue("@p6", record.MessageContent);

    cmd.ExecuteNonQuery();
}
</code></pre>

<p>where the <code>EventDateTime</code> string value is something like <code>2016/01/09 16:10:08.500</code></p>

<p>When I run a query on the table I get back this: <code>09/01/2016 16:10:08</code> </p>

<p>No milliseconds. I don't know if the values are going to the database or if it is the wrong type to use or if the query is not responding correctly: </p>

<pre><code>TestTable.Take (100)
</code></pre>