LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data insert into Mysql use 'DB TOOL INSERT DATA.VI'

Solved!
Go to solution

Hi Guys

I am making a test to insert some data into Mysql but comes a error(see the attached),where is wrong with the code?

Can someone give a hand please.

0 Kudos
Message 1 of 11
(4,106 Views)

You can't insert many rows by this way (You are trying to add just one item instead of many rows.).

 

1st way: thy C:\Program Files (x86)\National Instruments\LabVIEW XXX\examples\database\Database Logging (parameterized).vi

 

2nd way: build SQL request

sql.pngsql2.png

0 Kudos
Message 2 of 11
(4,085 Views)

Thanks for the reply,do you have an example because i am know with labview.

0 Kudos
Message 3 of 11
(4,077 Views)

sql.png

0 Kudos
Message 4 of 11
(4,063 Views)

Hi

I used your sample but still got error,i do not know what to try now

 

0 Kudos
Message 5 of 11
(4,058 Views)
Solution
Accepted by 314159ym

First, you should "try" to practice attentiveness, because you did NOT try my example, but something of your own.

INSERT INTO table_name (col1, col2, col3, col4) 
VALUES ('111', '2222', '3333', '4444') ('55', '6', '7', '8') ('12', '11', '10', '9 '))

This is NOT a valid SQL query and this is NOT what I sent.

 

Secondly, you should try to learn SQL syntax, then half the questions will disappear.

 

Here is what I sent as an example.

INSERT INTO table_name (col1, col2, col3, col4)
VALUES
('111', '2222', '3333', '4444'),
('55', '6', '7', '8'),
('12', '11', '10', '9');
0 Kudos
Message 6 of 11
(4,053 Views)

Now it works like that,thanks for help.

 

 

0 Kudos
Message 7 of 11
(4,041 Views)

Hi Sir, 

 

Seems you are familiar with the database operation of labview.

Hence i have a question beyond this topic, could i use the udl to connect to local mysql server ?

If yes, what provider should i choose ?

Thanks.

Keep moving
0 Kudos
Message 8 of 11
(3,340 Views)

@Brzhou123 wrote:

could i use the udl to connect to local mysql server ?

If yes, what provider should i choose ?


yes, and how to configure udl you can read here



0 Kudos
Message 9 of 11
(3,315 Views)

Hi Sir, 

 

Thanks for the details.

I think the key point is the connection string:

Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Port=3306;Database=myDataBase;
User=myUsername;Password=myPassword;Option=3;

 

So prior to do this setting, i need to install the mysql odbc 5.1, then in the provider page, i choose it ?

Keep moving
0 Kudos
Message 10 of 11
(3,312 Views)