title: Inserting the current datetime in vb.net(DateTime to String Conversion)
body: <p>I'm suppose to enter datatime to the database by passing this query</p>
  
  <pre><code>Dim regDate As DateTime = DateTime.Now
  Dim strDate As String = regDate.ToString("yyyyMMddHHmmss")
  </code></pre>
  
  <p>I pass the "strDate" to the query,data type of my database table is datetime</p>
  
  <pre><code>objcon.DoExecute("INSERT INTO DistributorF VALUES('" &amp; txtDisId.Text &amp; "',
       '" &amp; txtDisNm.Text &amp; "','" &amp; txtDisAdd.Text &amp; "',
       '" &amp; txtDisTele.Text &amp; "','" &amp; txtDisEmail.Text &amp; "','" &amp; regDate &amp; "')")" 
  </code></pre>
  
  <p>but it's getting error saying that </p>
  
  <blockquote>
    <p>conversion failed when converting date and/or time from character string.</p>
  </blockquote>
  
  <p>Help me to solve this problem</p>