-2147217403 (80041005) type mismatch error on Dell D 620 laptop

H

hardikbelani

-2147217403 (80041005) type mismatch error on Dell D 620 laptop

I have following code to get information about network interfaces

-----------------------------------------------------------
Dim moMgmtObjSearcher As ManagementObjectSearcher = New
ManagementObjectSearcher
Dim moMgmtObjCollection As ManagementObjectCollection
Dim moMgmtObject As Management.ManagementObject
Dim moMgmtBaseObject As ManagementBaseObject
Dim moMgmtScope As Management.ManagementScope

Dim sWmiQuery As String = TextBox2.Text
Try
Dim oEnumerationOptions As New EnumerationOptions
oEnumerationOptions.ReturnImmediately = True

moMgmtObjSearcher.Scope.Path.Path = "root\cimv2"
moMgmtObjSearcher.Query.QueryString = "SELECT *
FROM Win32_NetworkAdapter WHERE ProductName = '" & I_sProductName & "'
AND ( AdapterTypeId = 0 OR AdapterTypeId = null ) AND NetConnectionId !
= null "

moMgmtObjSearcher.Options = oEnumerationOptions

moMgmtObjCollection = moMgmtObjSearcher.Get
For Each moMgmtObject In moMgmtObjCollection
If Not moMgmtObject Is Nothing Then
Return moMgmtObject
End If
Next
Return Nothing
Catch ex As Exception
AppendToLog("testWin32NetworkAdapterObject - Exception:" &
ex.Message + Space(5) + ex.Source + Space(5) + ex.StackTrace)
Return Nothing
End Try

----------------------------------------------------------------------------

This code fine on all the laptops on windows XP platform.

Now on a specific laptop Dell D620 which uses Intel(R) PRO/Wireless
3945ABG Network card for wifi connection, this code does not work and
give me following exeption if i disable my wireless interface card.

Exception(05-03-2007 2:4:54):GetWin32NetworkAdapterObject -
ex.ErrorCode = -2147217403
Exception(05-03-2007 2:4:54):GetWin32NetworkAdapterObject - Type
mismatch System.Management at
System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus
errorCode)
at System.Management.ManagementObjectEnumerator.MoveNext()
at
SGClient.SGClientHelperLib.cNICAdapter.GetWin32NetworkAdapterObject(String
I_sProductName, String I_sMacAddress, Int32 I_iDeviceId, String
I_sFields)

This exception occurs only if i disable my network card and on only
Dell D 620 laptop.

Any kind of help is appreciated.

Thanks in Advance,
Hardik Belani
 
M

Marty List

I'm curious to know why you added "OR AdapterTypeId = null" to your query.
And does the behavior change if you remove that?
 
M

Marty List

I'm curious to know why you added "OR AdapterTypeId = null" to your query.
And does the behavior change if you remove that?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top