Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5984419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:22:23+00:00 2026-05-22T22:22:23+00:00

Anyone know why my query select Name, ProcessID, Caption from Win32_Process where ProcessId=’ +

  • 0

Anyone know why my query "select Name, ProcessID, Caption from Win32_Process where ProcessId='" + processIds[index] + "'" return

 Column 'Name' does not belong to table Win32_Process

in my program C#.

In powershell when I execute

Get-WmiObject -query "select Name, ProcessID, Caption from win32_process"

It’s works !

   String queryString = "select Name, ProcessID, Caption from Win32_Process where ProcessId='" + processIds[index] + "'";
                SelectQuery query = new SelectQuery(queryString);

                ConnectionOptions options = new ConnectionOptions();
                options.Authentication = System.Management.AuthenticationLevel.PacketPrivacy;


                ManagementScope scope = new System.Management.ManagementScope("\\root\\cimv2");
                ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
                try
                {
                    ManagementObjectCollection processes = searcher.Get();
                    DataTable result = new DataTable();
                    foreach (ManagementObject mo in processes)
                    {
                        DataRow row = result.NewRow();
                        if (mo["Name"] != null)
                            row["Name"] = mo["Name"].ToString();
                        row["ProcessId"] = Convert.ToInt32(mo["ProcessId"]);
                        if (mo["Caption"] != null)
                            row["Caption"] = mo["Caption"].ToString();
                        result.Rows.Add(row);
                    }

Thanks for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:22:24+00:00Added an answer on May 22, 2026 at 10:22 pm

    This code:

    const string queryString = "SELECT Name, ProcessID, Caption FROM Win32_Process";
    
    var scope = new ManagementScope(@"\root\cimv2");
    var query = new ObjectQuery(queryString);
    var searcher = new ManagementObjectSearcher(scope, query);
    var objectCollection = searcher.Get();
    
    foreach (var o in objectCollection)
    {
        Console.WriteLine("{0} {1} {2}", o["Name"], o["ProcessID"], o["Caption"]);
    }
    

    …works fine for me. Exactly how is your code not working?

    (You don’t appear to be doing anything with options, by the way).

    Update:

    It’s actually complaining because you’ve not set up the columns in your DataTable. I think that you’ve cut down your example too much. Your DataTable is called “Win32_Process”, yes? If I call mine “Albert”:

    var table = new DataTable("Albert");
    

    I get Column 'Name' does not belong to table Albert.

    You need to do something like the following:

    var table = new DataTable("Albert");
    table.Columns.Add("Name");
    table.Columns.Add("ProcessID", typeof(int));
    table.Columns.Add("Caption");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know what is wrong with this query? SELECT DISTINCT c.CN as ClaimNumber,
Does anyone know the query the last synchronization date from sql server (2008). It
Does anyone know of a definitive list of LINQ to SQL query limitations that
I have this query: SELECT groups.name categories.name, categories.label FROM groups JOIN categories ON (categories.group1
I have this query: SELECT to_number(gr.code) group_index, gr.NAME group_name, f.*, gr.description gr_desc FROM obj$groups
Anyone know how to query for a specific date within entity framework ? I
Anyone know this compiler feature? It seems GCC support that. How does it work?
I am trying to write the following query on postgresql: select name, author_id, count(1),
If I'm getting my data from Mysql like so: $result = $dbConnector->Query(SELECT * FROM
I have the following query select * from Properties join PPHL on PPHL.postcode =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.