title: trasmitting data to mySQL through VB.NET
body: <p>I'l like to get the datetime from my PC and send it over to my table
  Here it is : Failure to communicate / String was not recognized as a valid DateTime
  How to make the current date so when I pass it over to my DB ?</p>
  
  <pre><code>  Dim regDate As Date = Date.Now()
              Dim strDate As String = regDate.ToString("MM\/dd\/yyyy")
  </code></pre>
  
  <p>SQL throws me an error if I use this : </p>
  
  <pre><code>SQLcmd.Parameters.AddWithValue("@Data", Convert.ToDateTime(strDate))
  </code></pre>
  
  <p>Error is :  String was not recognized as a valid DateTime</p>
  
  <pre><code>            Dim SqlQuery1 As String = "INSERT INTO pontaj(id_pontaj,id,prezente,data) " &amp; _
                  "VALUES (0,@Id,1,@Data)"
  
  
              Using con = New MySqlConnection("Server = localhost;Database = users; Uid=root; Pwd = password")
                  Using SQLcmd = New MySqlCommand(SqlQuery1, con)
                      con.Open()
                      'SQLcmd.ExecuteNonQuery()
  
                      '  SQLcmd.Parameters.Add(New MySqlParameter("@Id_presence", TextBox1.Text))
                      '  SQLcmd.Parameters.Add(New MySqlParameter("@Id", TextBox2.Text))
                      '  SQLcmd.Parameters.Add(New MySqlParameter("@Hours", TextBox3.Text))
                      '  SQLcmd.Parameters.Add(New MySqlParameter("@Date", TextBox4.Text))
  
  
                      ' SQLcmd.Parameters.AddWithValue("@Id_presence", Convert.ToInt32(TextBox1.Text))
                      SQLcmd.Parameters.AddWithValue("@Id", Convert.ToInt32(Label5.Text))
                      ' SQLcmd.Parameters.AddWithValue("@Prezente", Convert.ToInt32(TextBox3.Text))
                       SQLcmd.Parameters.AddWithValue("@Data", Convert.ToDateTime(strDate))
  
  
                      SQLcmd.ExecuteNonQuery()
                  End Using
  
  
              End Using
  </code></pre>