retrieve data from SQL
I need to display data based on the column name. The name is captured from the URL parameter and passed to Flash with Javascript.
Flash retrieve it with:
var varMedia = ExternalInterface.call("getParameter1");
Then I use the following function to retrieve and display data:
function displayRatingOnSQL():void
{
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void
{
var tAverage = (e.target.data.Average);
var tTotalVotes = (e.target.data.TotalVotes);
var tTotalRate1 = (e.target.data.star1);
var tTotalRate2 = (e.target.data.star2);
var tTotalRate3 = (e.target.data.star3);
var tTotalRate4 = (e.target.data.star4);
var tTotalRate5 = (e.target.data.star5);
var temp = tTotalRate5 + "\n" + tTotalRate4 + "\n" + tTotalRate3 + "\n" + tTotalRate2 + "\n" + tTotalRate1;
totalForEachStar.text = temp;
tAve.text = tAverage;
totalVotes.text = "(" + tTotalVotes + ")";
}
var extraString = Math.random();
myTextLoader.load(new URLRequest("http://dntin1web01/tpas/SQL/GniePageRatePageRead.asp?qs="+ extraString));
}
In ASP page, I have the following to pick up name for the column to extract data:
Dim tPageMedia
tPageMedia = Request.Form("varMedia")
Then I try to use the following to retrieve:
SQL = SQL & "WHERE ( [PageName] = " & "'" & tPageMedia & "') "
I got nothing. It works if I put a hard coded name replacing the dynamic one.
How can I pass the varMedia to ASP page? The variable in Javascript is var1.
