NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching a Database using TestStand

Hi.
I would like to search a database for UUT Serial Numbers, so that I avoid duplicates. At the moment I am looping through the appropriate table and comparing my existing serial number with that of each record retrieved. Unfortunately, if a match is not found, it reaches the end of the database and throws an error:

Record not found.


Error getting data from column "Device_ID". Native error code -2146825267 0x800a0bcd
ADODB.Field:
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

My question is, how to I check if the record I have retrieved is the last one in the database using TestStand?

I have attached the database sequence of my code for clarity.

Regards.
Neil.
0 Kudos
Message 1 of 3
(3,229 Views)
You're making it way too complicated. Do a query like "SELECT DEVICE_DETAILS.ID FROM DEVICE_DETAILS WHERE DEVICE_DETAILS.ID = " RunState.Root.Locals.UUT.SerialNumber. Then Locals.NumRecords will contain the number of records that have that serial number. Anything greater than 0 will mean a duplicate. No looping is required and you don't actually have to retrieve any data.
Message 2 of 3
(3,223 Views)
Don't know if you'll read this, but thanks for the feedback.

I'm a total novice at TestStand and SQL/Databases, so it's very much appreciated!

Cheers.
0 Kudos
Message 3 of 3
(3,213 Views)