ARTICLE AD BOX
if (connection.State == ConnectionState.Closed)
{
connection.Open();
string signup = "INSERT INTO TABLE (ID,NAME,SURNAME,MAIL,PASSWORD) VALUES (@ID,@NAME,@SURNAME,@MAIL,@PASSWORD)";
SqlCommand command = new SqlCommand(signup, connection);
command.Parameters.AddWithValue("@ID", ID.Text);
command.Parameters.AddWithValue("@NAME", NAME.Text);
command.Parameters.AddWithValue("@SURNAME", SURNAME.Text);
command.Parameters.AddWithValue("@MAIL", MAIL.Text);
command.Parameters.AddWithValue("@PASSWORD", PASSWORD.Text);
command.Parameters.AddWithValue("@DATE",dateTimePicker11.Value);
command.ExecuteNonQuery();
MessageBox.Show("REGISTRATION SUCCESSFUL", "Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
connection.Close();
}
I defined an SQL query like this, but the DATE value always returns null. How can I solve this problem?
28.4k15 gold badges62 silver badges88 bronze badges
5
