<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
var rs;
var xmldoc;
var xmlstream;
function SendRS_onclick() {
xmlstream = new ActiveXObject("ADODB.Stream");
xmlstream.Mode = 3; //read write
xmlstream.Open();
xmlstream.Type = 1; // adTypeBinary
rs.Save(xmlstream,0); //adpersistadtg
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("POST","http://localhost/Receiver.asp?getRecordset=NO",false);
xmlhttp.setRequestHeader("Content-Length",xmlstream.Size); //set the length of the content
xmlhttp.send(xmlstream.Read(xmlstream.Size)); //Send the stream
alert(xmlhttp.responseText);
}
function getRS_onclick() {
rs = new ActiveXObject("ADODB.Recordset");
xmldoc = new ActiveXObject("Msxml2.DOMDocument");
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("Get","http://localhost/Receiver.asp?getRecordset=YES",false);
xmlhttp.send();
xmldoc.loadXML(xmlhttp.responseText); //load the returned stream into the dom document
rs.Open(xmldoc); //load the dom document into the recordset
alert("Recordset Loaded");
}
function Update_onclick() {
alert("before: " + rs.Fields(2).Value);
rs.Fields(2).Value = rs.Fields(2).Value + "!";
rs.Update();
alert("after: " + rs.Fields(2).Value);
}
//-->
</SCRIPT>
<INPUT type="button" value="Get Recordset" id=getRS name=getRS LANGUAGE=javascript onclick="return getRS_onclick()">
<INPUT type="button" value="Update" id=Update name=Update LANGUAGE=javascript onclick="return Update_onclick()">
<INPUT type="button" value="Send Recordset" id=SendRS name=SendRS LANGUAGE=javascript onclick="return SendRS_onclick()">