Solved

Passing a variable where select * wants a literal, VB6

Posted on 2004-08-11
3
254 Views
Last Modified: 2012-05-05
Code:

For Each Process In GetObject("winmgmts:").ExecQuery("select * from Win32_Process where
Name='cmd.exe'")
        Process.Terminate
Next

I need to pass a variable to the Name= instead of a literal (here I put cmd.exe).  This should be easy but can't think of the answer. tried this no help:

Name='" & myVar)

0
Comment
Question by:bluedragon99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Author Comment

by:bluedragon99
ID: 11774876
Need to pass process.name
0
 
LVL 7

Accepted Solution

by:
Tanglin05 earned 500 total points
ID: 11774890
Did you try:

Name='"& myVar &"'")
0
 
LVL 1

Author Comment

by:bluedragon99
ID: 11774938
Perfect!  Thanks for the quick solution.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Make the most of your online learning experience.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question