title: Insert date into SQL Server database through vb.net
body: <pre><code>Dim SALESINSERT As New SqlCommand("INSERT INTO Tbl_Sales (Sale_id, Transaction_No, Customer_id, Item_id, Amount, Date) VALUES(" _
                                   &amp; SalesIdMax + 1 &amp; "," &amp; Transaction_label.Text &amp; "," &amp; 1 &amp; "," &amp; Label4.Text &amp; "," &amp; TextBox1.Text &amp; _
                                   "," &amp; DateTimePicker1.Value.Date &amp; ")", sqlcon)
  
  sqlcon.Open()
  SALESINSERT.ExecuteNonQuery()
  sqlcon.Close()
  
  SALESINSERT = Nothing        
  </code></pre>
  
  <p>I have this code. Everything works just fine, but the problem is with the date. For some reason it inserts the same date every time: "1/1/1900".</p>
  
  <p>When I debugged the code to see the SQL command text it was fine and the date was fine and I executed it in SQL query and it was perfectly fine.</p>
  
  <p>But in VB it doesn't.</p>
  
  <p>I do not know why it is not working. </p>
  
  <p>Please can I have suggestions to fix it.</p>