SalimYes Absent Member.
Absent Member.
262 views

Query With HP OO

hello
 
This is my first post on the site and I hope to find the answer. I am a beginner and I work for a few weeks on HP OO. I would like to make WMI queries that I had previously developed under visual studio.
For example I have an error message when I make this request:


Select * from Win32_Directory Where MyDrive = Drive and Path = MyPath


MyDrive and myPath are input varibles I use.


He told me that the request is not good. How can i resolved that error ?


Thank you for your feedback

Salim

Labels (1)
0 Likes
1 Reply
vinlane Absent Member.
Absent Member.

Re: Query With HP OO

Are you referencing the variables correctly in the SQL command?  So to reference the MyDrive variable, it would be ${MyDrive}. Also, keep in mind that a VARCHAR2 type needs to be surrounded by single-quotes (') in the SQL command. Unfortunately HPOO considers what is in single-quotes to be a literal, so if you try to put single quotes around ${MyDrive} in your query, it will pass ${MyDrive} rather than the value of MyDrive. So I usually put a single quote in a variable, and then reference it. So it would be ${SQ}${MyDrive}${SQ}. There may be a more elligant way to do this that I am not aware of.

 

Also, in your post you have MyDrive = Drive. I'm assuming you meant Drive = MyDrive.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.