Error Inserting: Incorrect integer value 'EXAMPLE' for column 'id_example' at Row 1

Asked

Viewed 438 times

1

I am trying to insert into my mysql database through Visual Studio 2017 - C# (localhost-wamppserver) but it is giving error.

The first column of the table records is the id_record which is the primary key of the table records and is auto_increment and so I did not specify it in Insert Into.

But for some reason the error is giving when inserting in the id_types that is the foreign key of the types table, I think it will be because I am using a combobox with the values of the type-name column of the table types and inserting the records into the table records because the fields with textbox are perfect, the error is described below and in the question title.

It will be because the values of the combobox are text and the column I am inserting is a foreign key INT?

I’m having the next mistake when inserting:

Incorrect integer value: 'TEXT' for column 'id_tipos' at row 1

My query:

string query = "INSERT INTO `registos`(`data`, `id_tipos`, `id_tec`,`id_processo`, `id_tarefa`, `horas`, `com`) VALUES ('" + datatp_1.Text + "','" + comboBox_tipo1.Text + "','" + comboBox_tec1.Text + "','" + comboBox_pro1.Text + "','" + comboBox_passos1.Text + "','" + txt_horas1.Text + "','" + txt_com1.Text + "')";

My query select * from records: BD

My query select * from registries + INNER JOIN: inserir a descrição da imagem aqui

  • You put the second value in parentheses being that it is a int. What is the value you are going through? Show us the query graduate

  • That part '" + comboBox_tipo1.Text + "', you are trying to add a text where it should be an integer. Remove the ' before and after!

  • What do you mean, query formed? query in Workbench?

  • Marconi removed the ' ' ' and continued to give the same friend error

  • What I would tell you is to debug your code and get the value as soon as you pass this line, then play the query in the bank and check what’s wrong.

  • Marconi has Dciscord for a more personalized help? I’m interning and I’m "new" in programming, would you help me in more detail

  • @gmbc yes, do what I told you above. Check this variable query by debug.

  • @Marconi I’ll try now, 2minutes, if you can add in Discord it’s better: Jøycelyn#3447

  • @Marconi debugged, selected the query and now?

  • Comments here for me see the result

  • Links from Imgur : https://imgur.com/a/PznHHWa The query does not show that messagebox at the time of insertion

  • It had to be after the variable to see the result of it.

  • That’s why I asked if you had Discord Maybe it would be easier if I shared the screen, the error (messagebox)

Show 8 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.