NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Set Command Timeout For SQL Server

Hello,

How do you set the command timeout for the 'open' statement? I am running a Database via SQL Server and I tried the dialog box timeout statement (the check box on the advanced tab) and simply get an error. The manual shows a 'step.commandtimeout' but how is it implemented?

Thanks,

Kevin
0 Kudos
Message 1 of 4
(4,653 Views)
Kevin -
Questions to clarify the issue:

1) What version of TestStand?

2) Does the Statement step work if you do not specify a timeout setting on the advanced tab and instead use the default?

3) What is the error that you get, "Invalid attribute for recordset based statement". This is the error that the CVI SQL Toolkit returns if you attempt to set the timeout parameter for a "SELECT" type SQL statement. I am not sure if this is a valid limitation but this is the current implementation of the CVI SQL Toolkit.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 2 of 4
(4,653 Views)
Right on...sorry -

1) TestStand 2.0 (any reason to go to 2.0.1f1?)

2) Yes it works fine if you leave it set to default.

3) This is the error I am getting back:

Details: Error executing substep 'Post'. Invalid attribute for recordset based statement.

Error Code: -76; User-defined error code.

Location: Step 'Open prod_meta' of sequence 'PreUUT' in 'SequentialModel.seq'

Also, I am using LabVIEW 6.1 with the Database Connectivity toolset (ver 1.0.1)

Thanks,

Kevin
0 Kudos
Message 3 of 4
(4,653 Views)
Kevin -
I looked at the internal implementation of the CVI SQL Toolkit. The toolkit function that the step type uses is DBNewSQLStatement. Internally to the toolkit the function opens a recordset instead of a command object. The command timeout attribute is only available on a command object and not on a recordset object, so as implemented inside the toolkit the error is appropriate. I think the toolkit could have used a command object to create the recordset object and this would allow the toolkit to let you set the timeout attribute. Unfortuneately this is not the way it was done.

For the future I may investigate to see if there is a way to bypass this limitation by using different toolkit functions, but I am not sure if there a
re any side effects.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 4 of 4
(4,653 Views)