title: inserting Date Time to sql server 2008 using c#
body: <p>I get <code>failed to convert parameter value from a string to a datetime</code> error, I have a text box in which the user should insert a date, my code is:</p>
  
  <pre><code>SqlConnection Con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\targil3.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
  SqlDataAdapter adapt = new SqlDataAdapter();
  adapt.InsertCommand = new SqlCommand("INSERT INTO tblEmployee VALUES (@employeeNumber, @employeePrivateName, @employeeFamilyName ,@city, @street, @houseNo, @phoneNumber, @birthDate, @startWorkingDate)", Con);
  adapt.InsertCommand.Parameters.Add("@employeeNumber", SqlDbType.VarChar).Value = textBox1.Text;
  adapt.InsertCommand.Parameters.Add("@employeePrivateName", SqlDbType.VarChar).Value = textBox2.Text;
  adapt.InsertCommand.Parameters.Add("@employeeFamilyName", SqlDbType.VarChar).Value = textBox3.Text;
  adapt.InsertCommand.Parameters.Add("@city", SqlDbType.VarChar).Value = textBox4.Text;
  adapt.InsertCommand.Parameters.Add("@street", SqlDbType.VarChar).Value = textBox5.Text;
  adapt.InsertCommand.Parameters.Add("@houseNo", SqlDbType.Int).Value = textBox6.Text;
  adapt.InsertCommand.Parameters.Add("@phoneNumber", SqlDbType.VarChar).Value = textBox7.Text;
  adapt.InsertCommand.Parameters.Add("@birthDate", SqlDbType.DateTime).Value = textBox8.Text;
  adapt.InsertCommand.Parameters.Add("@startWorkingDate", SqlDbType.DateTime).Value = textBox9.Text;
  
  Con.Open();
  adapt.InsertCommand.ExecuteNonQuery();
  Con.Close();
  </code></pre>
  
  <p>How do I get it to work?</p>