title: How to insert current date and time in sql server database using timestamp datatype?
body: <p>I want to insert current date and time into sql server database from asp.net webpage. I am using timestamp datatype in sql server table. </p>
  
  <p>table structure:</p>
  
  <pre><code>CREATE TABLE user3
    (
       uname VARCHAR(50) PRIMARY KEY,
       email VARCHAR(50),
       doj   TIMESTAMP
    ); 
  </code></pre>
  
  <p>code used :</p>
  
  <pre><code>   cmd.Parameters.Clear();
          cmd.CommandText = "insert into user3 values(@uname,@email,@doj)";
          cmd.Parameters.AddWithValue("@uname", uname);           
          cmd.Parameters.AddWithValue("@email", email);   
          cmd.Parameters.AddWithValue("@jdate", DateTime.Now);
          if (cn.State == ConnectionState.Closed)
              cn.Open();
          cmd.ExecuteNonQuery();
          cn.Close();
  </code></pre>
  
  <p>Please Help me with your suggestions and solutions.</p>