LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

database toolkit - stored procedure doesn't work in labview

Hello,

 

I have written simple procedure that works good when I run it from workbench but doesn't work from labview. I want to insert some data and get primary key of inserted id:

 

CREATE DEFINER=`root`@`localhost` PROCEDURE `new_procedure`(
IN emp_id_val int,
IN project_id_val int,
IN work_mode_val int)
BEGIN
insert into work_managment.sessions (emp_id,project_id,work_mode)
values (11,1,1);
SELECT LAST_INSERT_ID();
END

 

and why that doesn't work when I call it from labview?

 

when i replace last inserted id with:

select max(session_id) as session from work_managment.sessions;

it works good in labview

 

What could be the problem??

0 Kudos
Message 1 of 3
(2,857 Views)

Dear Pawel,

 

From what I see, the problem could be that the table reference for LAST_INSERT might not be stored properly. Could you send me the LabVIEW code that produces the error? If it is reproducible, I can forward the issue to the developers.

 

In the meantime you can use the SELECT MAX() command as you have done.

 

 Regards:

Andrew Valko
National Instruments Hungary
0 Kudos
Message 2 of 3
(2,756 Views)
It could be that there is something screwy with LV, but given that it uses standard interfaces for comm with the DBMS, I would not expect that. A much more realistic possibility is that the toolkit is mucking things up. (A fairly common occurrence.)

Try bypassing the toolbox -- which you don't really need anyway -- an talk directly to the ActiveX or .net interface.

Also, what DBMS? What drivers are you using?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 3
(2,718 Views)