I have a code segment in a asp page for retrieving a xml document from a database as follow:
1. dim rs
2. dim doc
3. dim cn
4. dim searchField, withField
' Create Objects
5. set cn = server.CreateObject("ADODB.Connection"
6. set rs = server.CreateObject("ADODB.Recordset"
7. set doc = server.CreateObject("MSXML2.DomDocument"
' Open Connection
8. cn.Open "CDLibrary;", "sa", "sqlserver2000"
' Get required data
9. rs.Open "select * from CD", cn, 0, 3
' Save Recordset to DOMDoc as XML
10. rs.Save doc, adPersistXML
' Set Response property
11. Response.ContentType = "text/xml"
' Stylesheet for browser display
12. Response.Write "<?xml:stylesheet type=""text/xsl"" href=""CDList.xsl""?>" & vbcrlf
13. Response.Write doc.xml
At 10th line, why the doc is still empty after saving? Can who help me?
1. dim rs
2. dim doc
3. dim cn
4. dim searchField, withField
' Create Objects
5. set cn = server.CreateObject("ADODB.Connection"
6. set rs = server.CreateObject("ADODB.Recordset"
7. set doc = server.CreateObject("MSXML2.DomDocument"
' Open Connection
8. cn.Open "CDLibrary;", "sa", "sqlserver2000"
' Get required data
9. rs.Open "select * from CD", cn, 0, 3
' Save Recordset to DOMDoc as XML
10. rs.Save doc, adPersistXML
' Set Response property
11. Response.ContentType = "text/xml"
' Stylesheet for browser display
12. Response.Write "<?xml:stylesheet type=""text/xsl"" href=""CDList.xsl""?>" & vbcrlf
13. Response.Write doc.xml
At 10th line, why the doc is still empty after saving? Can who help me?