1
Speak guys I have a problem that is send my DTPentrar
alias DataTimePicker
, follows photo of the error and the code, if anyone can give a light thank you. Hugs
private void btnSalvar_Click(object sender, EventArgs e)
{
try
{
conectar.Open();
//int DataEntrada = Convert.ToInt32(DTPEntrada.Text);
//MessageBox.Show("Conectado");
MySqlCommand Inserir = new MySqlCommand();
Inserir.Connection = conectar;
Inserir.CommandText = Inserir.CommandText = "INSERT INTO Pacote (peca, Nome, Quantidade, Data_entrada) VALUES ('"
+ cbxPeca.Text + "', '" + txtNome.Text + "', '"
+ txtQuantidade.Text + "', '" + DTPEntrada + "'); ";
Inserir.ExecuteNonQuery();
conectar.Close();
MessageBox.Show("Cadastro Realizado!", "Concluido",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
selecionarCategoria();
}
catch (SqlException)
{
MessageBox.Show("Falha na conexao!", "falha",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
Screenshot of the above error and the bank code below
Here the error, after the suggestion of @Augusto
Look, I’ve never worked with
C#
but you wouldn’t have to "treat" your date before entering ? It shouldn’t be like2019-03-21 00:00:00
for insertion in the seat ?– 8biT
@8bit how should I treat my date ? I’m kind of new at language
– Pietro Nunciaroni