This code I pasted below is runs a query and builds a xml object. I have no clue some of the records that the query returns are not in xml. I' m trying to read from xml again so that is where I know some records are missing.can anyone please help?
Populate Xml from sql query
<%
Const adPersistXML = 1
dim xmlJobCodes
dim xslJobCodes
dim oConn
dim oCmd
dim oRSheader
dim strSQL
dim bshowEdits
dim xslrecCleaner
dim xmlDoc
set xmlJobCodes = Server.CreateObject("MSXML2.DOMDocument")
xmlJobCodes.async = false
'build sql statements
strSQL = "select * from brc..c_xjcd order by JOB_CD"
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionString = application("ariConnectString") 'ariConnectString
oConn.Open
Set oRSheader = Server.CreateObject("ADODB.Recordset")
oRSheader.Open strSQL, oConn
'dump ado recordset into xml doc
Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument")
oRSheader.save xmlDoc, adPersistXML
'transform ado recordset xml into streamlined xml
Set xslrecCleaner = CreateObject("MSXML2.DOMDocument")
xslrecCleaner.load(Server.MapPath("xml/brc_ado_to_recordset.xsl"))
xmlJobCodes.loadXML(xmlDoc.transformNode(xslrecCle aner))
bshowEdits = true
%>
Read from XMl this is java script. It enters into the else part for some of the job codes which are actually part of sql query result set.
function fJobCodeSet(){
var xmlJobNode;
var nLabor_rate;
//set the description
xmlJobNode = xrs_job_code.selectSingleNode('//record[@job_code="' + document.builder.job_code.value + '"]');
if (xmlJobNode!=null){
document.builder.narrative.value = xmlJobNode.selectSingleNode("description").text;
document.builder.billing_hours.value = xmlJobNode.selectSingleNode("bill_hours").text;
//set the job code removed default
document.builder.job_code_removed.value = document.builder.job_code.value;
fDoBRCMath();
}else{
alert("No job found for code " + document.builder.job_code.value);
};
}
thanks
Mythili