![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a script (thanks to Darren) that is working to import an XML file into a database. Unfortunately, sometimes a node does not exist at all. I tried using IsObject .. and IsNull but I still get the same error. Any ideas would be greatly appreciated IF IsObject( objTitleNode.selectSingleNode("title-info/genre").nodeTypedValue ) Then sGenre = Left(objTitleNode.selectSingleNode("title-info/genre").nodeTypedValue,25) Else sGenre = "" End If |
#3
| |||
| |||
|
|
You cannot read a property from an object that is nothing, so you must first check if the selectSingleNode actually returned anything- Set oNode = objTitleNode.selectSingleNode("product-info/upcXX") If Not oNode Is Nothing Then sUPC = oNode.nodeTypedValue -- Darren Green http://www.sqldts.com "Stacey Levine" <staceyl (AT) SMAPFILTERmusicforasong (DOT) com> wrote in message news:%23MELSOA7DHA.712 (AT) tk2msftngp13 (DOT) phx.gbl... I have a script (thanks to Darren) that is working to import an XML file into a database. Unfortunately, sometimes a node does not exist at all. I tried using IsObject .. and IsNull but I still get the same error. Any ideas would be greatly appreciated IF IsObject( objTitleNode.selectSingleNode("title-info/genre").nodeTypedValue ) Then sGenre = Left(objTitleNode.selectSingleNode("title-info/genre").nodeTypedValue,25) Else sGenre = "" End If |
#4
| |||
| |||
|
|
-----Original Message----- You cannot read a property from an object that is nothing, so you must first check if the selectSingleNode actually returned anything- Set oNode = objTitleNode.selectSingleNode("product- info/upcXX") If Not oNode Is Nothing Then sUPC = oNode.nodeTypedValue -- Darren Green http://www.sqldts.com "Stacey Levine" <staceyl (AT) SMAPFILTERmusicforasong (DOT) com wrote in message news:%23MELSOA7DHA.712 (AT) tk2msftngp13 (DOT) phx.gbl... I have a script (thanks to Darren) that is working to import an XML file into a database. Unfortunately, sometimes a node does not exist at all. I tried using IsObject .. and IsNull but I still get the same error. Any ideas would be greatly appreciated IF IsObject( objTitleNode.selectSingleNode("title- info/genre").nodeTypedValue ) Then sGenre = Left(objTitleNode.selectSingleNode("title- info/genre").nodeTypedValue,25) Else sGenre = "" End If . |
![]() |
| Thread Tools | |
| Display Modes | |
| |