title: to insert only date in dd/mm/yyyy format from textbox.error while inserting dates in vb.net
body: <p>'  Code For Insert query to insert data.'</p>
  
  <pre><code>   Try
          Dim Query As String
          Query = "Insert * into test"
          Dim cmd As SqlCommand
          Query = "Insert into test(name,date,d1,d2,d3)values(@name,Getdate(),Convert(varchar,@d1,103),Convert(varchar,@d2,103),Convert(varchar,@d3,103))"
      'Convert Function used to insert date in dd/MM/yyyy format'
          cmd = New SqlCommand(Query, con)
          con.Open()
          cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = TextBox1.Text
          cmd.Parameters.Add("@d1", SqlDbType.DateTime).Value = TextBox2.Text
          cmd.Parameters.Add("@d2", SqlDbType.DateTime).Value = TextBox3.Text
          cmd.Parameters.Add("@d3", SqlDbType.DateTime).Value = TextBox4.Text
  
         cmd.ExecuteNonQuery()
         con.Close()
         lblvalid.Visible = True
          lblvalid.Text = "Record is inserted successfully"
  
      Catch ex As Exception
          lblvalid.Text = (ex.Message)
  
      End Try
  </code></pre>
  
  <p>'while inserting value in datetime.I want to insert in only date form'</p>