SelectQuery Class
Represents a WQL SELECT data query.
For a list of all members of this type, see SelectQuery Members.
System.Object
System.Management.ManagementQuery
System.Management.ObjectQuery
System.Management.WqlObjectQuery
System.Management.SelectQuery
[Visual Basic] Public Class SelectQuery Inherits WqlObjectQuery [C#] public class SelectQuery : WqlObjectQuery [C++] public __gc class SelectQuery : public WqlObjectQuery [JScript] public class SelectQuery extends WqlObjectQuery
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Example
[C#] using System; using System.Management; // This sample demonstrates how to perform a WQL select query. class Sample_SelectQuery { public static int Main(string[] args) { SelectQuery selectQuery = new SelectQuery("win32_logicaldisk"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(selectQuery); foreach (ManagementObject disk in searcher.Get()) { Console.WriteLine(disk.ToString()); } return 0; } } [Visual Basic] Imports System Imports System.Management ' This sample demonstrates how to perform a WQL select query. Class Sample_SelectQuery Overloads Public Shared Function Main(args() As String) As Integer Dim selectQuery As New SelectQuery("win32_logicaldisk") Dim searcher As New ManagementObjectSearcher(selectQuery) Dim disk As ManagementObject For Each disk In searcher.Get() Console.WriteLine(disk.ToString()) Next disk Return 0 End Function End Class
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Management
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Management (in System.Management.dll)