i have an ation script code that send SQL statements to an Asp.Net2 page and here it’s:
package
{
import flash.display.MovieClip;
import flash.xml.;
import flash.events.;
import flash.net.*;
public class Script1 extends MovieClip
{
public function Script1()
{
var SQLXML:String = “”;
SQLXML = createSQLXML("SELECT * FROM [dbo].[Tournaments] ", “Tournaments”);
sendSQLXML(“http://localhost/Trial/Default.aspx”,SQLXML,handleXMLData);
}
public function fixSingleQuotes(strTemp:String):String
{
var pattern:RegExp = /\x27/gi;
return (strTemp.replace(pattern, "'"));
}
public function createSQLXML(SQL:String, DataLabel:String):String
{
return ("<SQL SQL='" + fixSingleQuotes(SQL) + "' Name='" + DataLabel + "'></SQL>");
}
public function sendSQLXML(aspURL:String, SQLXML:String, returnSQLXMLCallback:Function):void
{
var myXMLURL:URLRequest = new URLRequest(aspURL);
var variables:URLVariables = new URLVariables();
variables.xmlSQL = "<MySQLRequest>" + SQLXML + "</MySQLRequest>";
myXMLURL.data = variables;
myXMLURL.method = URLRequestMethod.POST;
var myLoader:URLLoader = new URLLoader();
myLoader.addEventListener("complete", returnSQLXMLCallback);
myLoader.load(myXMLURL);
}
public function handleXMLData(evtObj:Event):void
{
// Put the returned XML in an XML object.
var MySQLXML:XML = XML(evtObj.target.data);
// This will get you to where the data begins.
var MySQLDataXML:XMLDocument = new XMLDocument();
MySQLDataXML.ignoreWhite = true;
MySQLDataXML.parseXML(MySQLXML);
// Dig deeper for the data.
var rsNode:Object = MySQLDataXML.firstChild.firstChild;
// Walk the returned recordset.
while (rsNode != null)
{
var DataNode:Object = rsNode.firstChild;
while (DataNode != null)
{
var FieldNode:Object = DataNode.firstChild;
// Handle data based on which SQL call this
// data comes from.
if (rsNode.nodeName == "Tournaments")
{
// Go through the fields returned.
while (FieldNode != null)
{
if (FieldNode.nodeName == "EName")
{
//Do something with first field data.
var strFirstFieldName:String = "EName";
strFirstFieldName = FieldNode.firstChild.nodeValue;
trace(strFirstFieldName);
}
else if (FieldNode.nodeName == "AName")
{
//Do something with second field data.
var strSecondFieldName:String = "AName";
strSecondFieldName = FieldNode.firstChild.nodeValue;
trace(strSecondFieldName);
}
else if (FieldNode.nodeName == "AName")
{
//Do something with third field data.
var strThirdFieldName:String = "AName";
strThirdFieldName = FieldNode.firstChild.nodeValue;
trace(strThirdFieldName);
}
//Move to next field node.
FieldNode = FieldNode.nextSibling;
}
}
// Move to next data node.
DataNode = DataNode.nextSibling;
}
// Move to next SQL call's recordset.
rsNode = rsNode.nextSibling;
}
}
}
}
and i need the C# code that is written in the Ap.Net page to extract the XML data (SQL statements) and execute the SQL statements on SQLserver2005 and return the result to the actionscript3
can any one help me plz in sending to me the code
thanks