ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Write in SQL Database Issue

Hello,
I'm trying to use a database and I'm reading from it without any problems, but when I try to write, I get the following error (please see picture):

Can you please help me?

Thanks in advance

0 Kudos
Message 1 of 5
(614 Views)

The error in English is "The operation is not permitted for a closed object" and this suggests that either the data operation does not match the SQL object you opened. The Put and Set New Record data operation is for a Recordset object. You should use the Execute operation, which is for INSERT command, which will specify the parameters to use when inserting the new record.

 

Scott Richardson
https://testeract.com
0 Kudos
Message 2 of 5
(584 Views)

Hello Scott,

 

thanks so much for your time and answer. I was trying to use the "Execute Procedure" but I´m getting also error.

Please see attached pictures.

 

Thanks so much again

0 Kudos
Message 3 of 5
(567 Views)

As for the first two error messages, do Time  an ID  really exist in this context?

The third one is obvious, since you are trying to write a number to a field which should be a string value

0 Kudos
Message 4 of 5
(563 Views)

Hello Oli,

my SQL statement is:

"INSERT INTO HV_TestStatus VALUES ('" + Parameters.Date + "','" + Parameters.ID + "','" + Str(Parameters.Counter) + "')"

 

and they exist in the same order in my database. If I do it with "Put New Record" it gives me an error but it does save the data correctly.

0 Kudos
Message 5 of 5
(558 Views)