我收到failed to convert parameter value from a string to a datetime
错误,我有一个文本框,用户应该在其中插入日期,我的代码是:
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();
我如何让它工作?