Marikit Avendano Marikit Avendano - 3 days ago 6
MySQL Question

How to display values from multiple textbox(vb net) to mysql database in column form

I have a database in MySQL named database1 and a table named records. I am trying to add the contents on my textboxes(3 textboxes) to my MySQL database in column form, not in row form.
Is it possible with

concat
???

The output I want
enter image description here

Here is my code, I created a row for typeofservice2, and typeofservice3but I only want one, which is type of service, and it looks like this
What I didenter image description here

Query = "insert into database1.records (dateoftrans,typeofservice,typeofservice2,typeofservice3) values('" & TextBox12.Text & "','" & tos & "','" & tos2 & "','" & tos3 & "')"


tos, tos2, and tos3 are my textboxes

Hope someone can help me

Answer

At first the question for me is quite tricky but then I get your point, I give it a shot.

your current query is this.

Query = "insert into database1.records (dateoftrans,typeofservice,typeofservice2,typeofservice3) values('" & TextBox12.Text & "','" & tos & "','" & tos2 & "','" & tos3 & "')"

The best way i can give to you is this.. Create 3 x Insert Command and each Query has there own tos(textbox name). do something like this.

Query1 = insert into database1.records(dateoftrans,typeofservice) values('" & TextBox12.Text & "','" & tos & "')

Query2 = insert into database1.records(dateoftrans,typeofservice) values('" & TextBox12.Text & "','" & tos2 & "')

Query2 = insert into database1.records(dateoftrans,typeofservice) values('" & TextBox12.Text & "','" & tos3 & "')

by that you can save all the values in same column.

Comments