Oprette et element med ID i
Hej Drenge oo pigerJeg sidder her og er ved at blive træt..
Jeg vil så gerne kunne lave et xml dokument der indeholder et element ved navn
<Phone_NO id = "12345678">
<active>1</active>
</Phone_NO>
Men jeg kan ikke finde ud af det... GRRRR her er min kode:
Function Main()
WriteXML()
Main = DTSTaskExecResult_Success
End Function
Function WriteXML()
Dim objADORS
Dim objXMLDoc
Dim nodeRoot
Dim nodeTemp
Dim nodeRelease
'Create ADO and MSXML DOMDocument Objects
Set objADORS = CreateObject("ADODB.Recordset")
Set objXMLDoc = CreateObject("MSXML2.DOMDocument.3.0")
'Run the stored procedure and load the Recordset
objADORS.Open "SELECT * FROM activePhones ", _
"Provider=SQLOLEDB;Data Source=192.168.15.XX\CRSSQL;Initial Catalog=custom_OpenClose;UID=XX;Password=XXXXX"
'Prepare the XML Document
objXMLDoc.loadXML "<root />"
Set nodeRoot = objXMLDoc.documentElement
'For each record in the Recordset
While Not objADORS.EOF
Set nodeRelease = objXMLDoc.createElement("Phone")
nodeRoot.appendChild nodeRelease
Set nodeTemp = objXMLDoc.createElement("Phone_NO")
nodeTemp.nodeTypedValue = Trim(objADORS.Fields("Phone_NO").Value)
nodeRelease.appendChild nodeTemp
Set nodeTemp = objXMLDoc.createElement("active")
nodeTemp.nodeTypedValue = Trim(objADORS.Fields("active").Value)
nodeRelease.appendChild nodeTemp
objADORS.moveNext
Wend
objADORS.Close
Set objADORS = Nothing
'Save the created XML document
objXMLDoc.Save "C:\XMLFiles\OpenClose.xml"
End Function