The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. <pre lang="cs">private void button1_Click(object sender, EventArgs e) { con.Open(); cmd = new SqlCommand("INSERT INTO Login(Admin,Password,Age,Gender,Dateofbirth)VALUES('" + textBox1.Text + "','" + textBox2.Text + "','"+textBox3.Text+"','"+ Gender +"','"+this.dateTimePicker1.Value.ToString("dd/mm/yyyy hh:mm") +"')", con); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("data Registered successfully!"); }</pre>
"mm/dd/yyyy"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)