DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

disable inbuilt diadem functions

Hi I'm accessing a database and I need to use the find method of the ADO recordset object
 
i.e. record_set.find("column1 = 10")
 
However diadem uses the inbuilt find function instead of the find method associated with the recordset
 
Can I stop diadem doing this?
 
Thanks for your help
 
Also I'm trying to avoid running too many SQL queries as they seem to be quite slow
0 Kudos
Message 1 of 5
(4,128 Views)

Hi lewis.may,

If you are executing the line of code you submitted, I cannot imagine DIAdem calling the Find() function instead of running the "Find" method of the record_set object.  DIAdem absolutely respects name space arguments and has no trouble calling methods of external objects, such as ADO objects.

Could you provide the relevant code you're running that causes the unexpected behavior?
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 5
(4,109 Views)

Hello Brad,

Thanks for your response the code thats giving me trouble is as follows

    Set connection = CreateObject("ADODB.Connection")

    query = "SELECT " & target_type & " FROM TableExample1 WHERE " & source_type & " = '" & source_code & "' " &_
            " UNION SELECT " & target_type & " FROM TableExample2 WHERE " & source_type & " = '" & source_code & "' "

    Set record_set = connection.Execute(query)

    If Not record_set is Nothing AND NOT record_set.EOF then

      record_set.find source_type & " = test"

    End If

There are a couple of things worth mentioning

firstly I'm using diadem V 8.10;

secondly the word "find" turns red;

thirdly the error message given is as follows "Arguments are of the wrong type, are out of acceptable range...."

 

I know there are other ways of creating a record set are these worth trying?

Thanks for your help

Lewis

0 Kudos
Message 3 of 5
(4,080 Views)
Hello Lewis!
 
The reason for the error is that in VBS optional parameters of COM objects are set to Empty if they are not defined (might be different to VB!). In the find method Empty values are not valid for the parameters 2, 3 and 4.
 
Try this:
 
record_set.find source_type & " = 'test'", 0, 1, 1
 
Note 1: I also added the single quotes around 'test'
Note 2: The DIAdem syntax highlighting doesn't always show you the 'truth'Smiley Wink
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 4 of 5
(4,075 Views)
Excellent, thank you Matthias that worked a treat Smiley Very Happy
0 Kudos
Message 5 of 5
(4,060 Views)