LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert data to SQL database table

Solved!
Go to solution

Hi.

I have a problem with labsql for insert a data into database,can someone tell me what is wrong this this code? Is the sql code error or i need a lab-sql inerset function?

 

Thanks

0 Kudos
Message 1 of 10
(3,172 Views)

A typo in the table name? "schoolinifo", instead of "schoolinfo"?

Message 2 of 10
(3,154 Views)

Do SQL insert handle unicode?

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 10
(3,137 Views)

No comma before values?

INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
0 Kudos
Message 4 of 10
(3,127 Views)

You will need to change the column handling unicode data to nvarchar imo. Is it nvarchar in this case?

I know for a fact that the ado client can handle unicode but it depends on the destination column of the table which dictates a successful insert. 

Message 5 of 10
(3,118 Views)

Hi 

 

I insert the data in mysql it works but in labview doesn't work with the same sql code.

And also i used the same code for insert the data into access it is also works.

0 Kudos
Message 6 of 10
(3,099 Views)

@314159ym wrote:

Hi 

 

I insert the data in mysql it works but in labview doesn't work with the same sql code.


The error message says: "You have an error in your SQL syntax; check [...] for the right syntax to use near ' values (  [...] ) ' at line 1"

I don't think you used the very same SQL code in LabVIEW as in MySQL.

Message 7 of 10
(3,092 Views)

Does any query work?

 

On the bottom it reads "select * from schoolinfo". If that works, "insert into schoolinifo" will not work.

0 Kudos
Message 8 of 10
(3,085 Views)

Hi 

 

The read query works,but insert not works

I used function "ADO SQL EXCUTE" Is this the right one or has other function i should use

0 Kudos
Message 9 of 10
(3,083 Views)
Solution
Accepted by topic author 314159ym

I don't know what the function is called (I don't even know what library you use), but usually the insert and select functions require either different functions, or setting in input (get results or something like that).

 

The insert will not give any results, and if the execute expects results, it will give an error.

0 Kudos
Message 10 of 10
(3,074 Views)