473,626 Members | 3,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help about WMI query to SMS Site!

Hi,

I have a problem about my ASP .NET App(C# .NET) to query SMS2003 via WMI.

My web server is IIS 6.0 on Win2003 Svr SP1(Domain Controller-AD + SMS2003
SP1).

In my btn_cliclk method, my query code is as below. My question is, the
first query
gets correct result, the server and site name, while the second query get a
null collection(Coun t=0), neither an exception nor a correct one.

I am clear that these two queries connect to diffrent namespaces. But I do
have made the same security setting for these two ones in WMI Control.

And when I run these WMI query via wbemtest on the server, I do get right
result for either of them.

This problem results from WMI setting, SMS2003 setting or my code?

This question has troubled me for some days. Any helps? Thank you very much
in advance.

David

=============== =============== =============== =============== =============== =
===============
//1st query
ManagementObjec tSearcher s=new ManagementObjec tSearcher(new
ManagementScope (@"root\sms") ,
new WqlObjectQuery( "SELECT * from SMS_ProviderLoc ation WHERE
ProviderForLoca lSite='TRUE'")) ;

foreach(Managem entObject oProvLocation in s.Get())
{
sProvMachine = oProvLocation.G etPropertyValue ("Machine").ToS tring();
sSiteCode = oProvLocation.G etPropertyValue ("SiteCode").To String();
}

strTemp = @"\\" + sProvMachine + @"\root\sms\sit e_" + sSiteCode;

string strFirstQueryRs t = @"Site = " + strTemp + "\r\n";

//2nd query
ManagementObjec tSearcher oSearcher = new ManagementObjec tSearcher(new
ManagementScope (strTemp),
new WqlObjectQuery( "SELECT * from SMS_Collection" ));

string strSecondQueryR st = "Count = " + oSearcher.Get() .Count.ToString () +
"\r\n";

foreach ( ManagementObjec t oInst in oSearcher.Get() )
{
strSecondQueryR st += oInst.GetProper tyValue("Collec tionID").ToStri ng() +
"\r\n";
}


Nov 17 '05 #1
0 2297

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2879
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine. Value selected is used as the 'where' clause of the 2nd query. If $site is a single word, the 2nd query works like a charm. If $site is more than one word (has spaces), the query returns a null
5
1915
by: *** HAWK | last post by:
I previously posted but didnt have much response. I have written out what exactly I am trying to do with my ASP site again but hopefully clearer. I am making a site will emulate something like hmv.com or cdwow.com - a website that allows users to view information of albums that are stored in a seperate access database. Ok. My database called 'cdshop.mdb' has 3 tables as follows: 1 - 'tblMusicAlbums' 2 - 'tblMusicTracks'
14
3221
by: Bruce W...1 | last post by:
I do a query to MySQL using PHP. Well actually I do too many of them which is the problem, it's too slow. I think maybe an inner join or something would be better but I can't figure this out. The web page on which the data is displayed has a list of countries. Each country has a label heading under which websites are listed that have information on that country. Any given website may appear many times (under different countries) if it...
0
2013
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary form by field named TestID. The subform is used just for displaying site address data, data which is stored in another table named Total_Site_Address. In the Total_Site_Address table there are numerous fields that form the site addresses...
3
1178
by: MattB | last post by:
Not sure if this is a good approach or not, but I'd like to hear some informed opinions. I've designed an ECommerce site that interfaces with my company's POS system. I'm trying to make it as flexible as possible because we resell it to our clients and they all have different needs and preferences. So the items for sale are displayed in a datagrid, and in the ItemDataBound event, I construct a URL with query strings so that when an item...
3
1155
by: deercreek | last post by:
Is there a way to sum a specific column in a query? What I have is a query that pulls several line based on a id field. I want to total just 1 column in the query and have it report back as new column. Example Id Site price date 101 201 40.00 1-11-05 101 404 25.00 1-11-05 101 600 15.00 1-11-05 and I would like to create a new column for total price that would show
5
1261
by: deercreek | last post by:
I have the following sql query listed below. I show the out put be low that. I am trying to get this query to toatl and only show the line of information with the total on it. Do you have any ideas? SELECT ReserveWithPrice.reservationid, ReserveWithPrice.Site, ReserveWithPrice.SitePrice, MyQuery.Total FROM ReserveWithPrice INNER JOIN . AS MyQuery ON ReserveWithPrice.Reservationid = MyQuery.id ORDER BY ReserveWithPrice.Reservationid;
0
5557
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
20
2443
lagomorphmom
by: lagomorphmom | last post by:
Hi, I'm a microbiologist but also dabble with many of the computer needs of our little lab. My latest project involves an unfinished database (Access 2000 format, I'm running 2003 on XP PC) inherited from a vendor. Although I've not used Access before, I've been plugged along with the help of our data manager (currently out with hip surgery) and guess I'm an intermediate user now. I do not know VBA although several misc. programming classes...
0
8272
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8205
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7206
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6126
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1516
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.