vb.net - Count in execquery for wql query -


i trying connect lenel , using wql fetch result. wql when runned in wmi explorer returns record.

set objservices = getobject("winmgmts://./root/onguard") set cardset = objservices.execquery("select * lnl_badge id =11111") if not cardset nothing response.write("<br/>cardset has something") vcontinue = true else response.write("<br/>cardset set nothing") exit function end if  response.write("<br/>count ") count = cardset.count response.write(count) 

the problem value of count coming nothing , program exit current function. idea wrong.

"cardset has something" displayed though.

edit:

for checking syntax did following cim2v

set objwmiservice = getobject("winmgmts:") set colitems = objwmiservice.execquery("select * win32_process") response.write(colitems.count) each colitem in colitems  if not colitem nothing     response.write("<br/>") response.write(colitem.processid) end if next 

to suprise working....then why above code not woking... :(

edit: error in log file

(tue aug 20 11:50:22 2013.179589208) : wdm call returned error: 4200 (tue aug 20 11:50:22 2013.179589208) : wdm specific return code: 4200 (tue aug 20 11:50:22 2013.179589208) :  

from understanding of wmi api reference, swbemservices.execquery method return swbemobjectset object if didn't encounter error, regardless of whether or not there results in object.

if query returns 0 results you'll still have valid object in cardset, if not cardset nothing statement trigger, unless there error, @ same time count still return 0.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -