Good morning, I had been able to do everything right up to this error when inserting something into the database. localhost / phpmyadmin - xampp.
It's something with id_user
but I do not know what it is. I do not insert a txtbox
nor combobox
into id_user
because I do not know what value I have to give it to him.
What to do?
Code and prints below!
I'm stuck here for 2 days and I do not know how to solve it.
NOTE If I need more info I give.
InsertCode>
privatevoidbtt_inserir_Click(objectsender,EventArgse){try{stringConexao_BD="datasource=127.0.0.1;port=3306;username=root;password=;database=tempos;SslMode = none;";
string Query = "INSERT INTO 'registos'('id_registo', 'data', 'id_tipo', 'id_tec', 'id_user', 'id_processo', 'id_tarefa', 'horas', 'comentarios') VALUES (NULL,'" + datatp_1.Text + "','" + comboBox_tipo1.Text + "','" + comboBox_tec1.Text + "','" + txt_teste.Text + "','" + comboBox_pro1.Text + "','" + comboBox_passos1.Text + "','" + txt_horas1.Text + "','" + txt_com1.Text + "')";
MySqlConnection CONEXAO_BD2 = new MySqlConnection(Conexao_BD);
MySqlCommand Comando2 = new MySqlCommand(Query, CONEXAO_BD2);
MySqlDataReader Ler_BD2;
CONEXAO_BD2.Open();
Ler_BD2 = Comando2.ExecuteReader();
msg.Inserir();
CONEXAO_BD2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}