Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XP Pro vs. W2K
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
XP Pro vs. W2K
Divers
Thread ID:
00997435
Message ID:
00997435
Vues:
53
I have a little piece of code here that works great on my development XP Pro computer (I have also verified that it works on 10 other XP Pro computers and also on a Windows 2003 Server), but it doesn't work on my test computer Windows 2000 (I have also tested it on another W2K machine and it doesn't work).
OK let's cut to the chase here is the code:
System.String Account = "Administrators";
System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_Account WHERE Name LIKE '" + Account + "'");

foreach (System.Management.ManagementObject mo in searcher.Get())
{
	if (MessageBox.Show(mo["Name"].ToString()+"\n"+mo["SID"].ToString(),"next?",MessageBoxButtons.YesNo) == DialogResult.No)
	{
		break;
	}
}
The important part in the code above is the 2nd line:
System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_Account WHERE Name LIKE '" + Account + "'");
I have narrowed it down to the LIKE keyword in the SQL select statement (the code works on a W2K machine if I just do : SELECT * FROM Win32_Account)

Now to my question: Can anyone explain why it doesn't work on a W2K machine? (Or even better give me a link to a M$ doc that says it doesn't work on a W2K machine but don't give an explanation <s>)

Feel free to try this on your W2K machine (you can prove me wrong and get it to work on a W2K machine).

Einar
Semper ubi sub ubi.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform