Having problems with an ASP,IIS and Flash top ten score table.
All works fine within flash itself. However when run through IE, when a player is added the database is updated but the Flash Display isnt. And even with a refresh it stays as the old display, the only way to update it is by closing IE (and the session) and re viewing. So i think it has something to do with the recordset i am using within the asp file and it not refreshing (or clearing content). Below is the ASP code i have written as a generic retreival file for flash (cConn is a ADODB.connection set in the global.asa file):
<%@ Language=VBScript%>
<%
Dim sSQL
Dim sendString
Dim t
Dim i
Dim rData
set rData=Server.CreateObject("ADODB.recordset")
sSqL=Request.QueryString("sendSQL")
rData.Open sSQL,cConn,3
do until rData.EOF
t=t+1
sendString=sendString&"VAR"&t&"="
for i=1 to rData.fields.Count
sendString=sendString&rData.fields.Item(i-1)
if i<>rData.Fields.Count then
sendString=sendString&","
else
sendString=sendString&"&"
end if
Next
There's a number of things that could be going on here.
I'm guessing your set up something like:
swf starts and loads data from an asp page which gets data from database.
You do something in flash which sends new data to the asp page which inserts into a database.
You then want to reload the info from the database, including the new info.
Whenever I've built this sort if thing, I've noticed that if I insert data and then try to retrieve straight away, flash doesn't allow enough time to actually process any asp scripts doing the insert.
The rubbish way to do it is add some sort of time delay between sending data to the asp page and then asking for the data back.
There's a few things you could do though that might sort it out:
Always use the full url of any asp page you call from flash - including the http:// - this means iis will process the asp page.
Another way to make sure that the asp page gets processed is add a time string to the url - when you call the asp page, rather than just calling mypage.asp, create a variable based on the current time and stick it on the end of the url of the asp page:
varTime = now(); - or however you do it in flash, i forget...
url = "http://mypage.asp?time=" + varTime
That way, iis will see it as a request for a different page each time you request it and force it run it.
You could also grab a variable from the asp page that inserts the data - have the page write out "&dataLoaded=true"
then in flash grab the variable dataLoaded, check if it's true - if it is, make a call to the asp page that retrieves data (with the time stamp thing) and it should run that page which will grab the new data....
Another way to do it is -
When the swf runs first time, it loads all the data from the asp page into and array (I'm guessing you're doing that anyway?)
Do your insert but also add those values to the array and just go through your array again as you did at the start..
That way, next time you load the swf, it will load all data but while you run it, it only writes to the database - not read from it...
Thanks for getting back, and cheers for the possible solutions.
I have gone through them and got a few queries i hope you can help me with.
with "?Time=randomnumber" option, i am using the LoadVars object to sendAndLoad data (assigning a onEnterFrame checker, so delayed anyway), and it seems this function applies a "?" anyway!
i.e.
getDbData.sendAndLoad(lobal.siteAddress+"getData.a sp?Time="+Math.floor(1000*(Math.random())+0.5),get DbData, "GET" )
Im not sure i understand your last suggestion redarding adding vars to the list, but this is probably me getting confused.
I have attached a zip of the code (ASP, FLA and Temp Database), so you can actually see what im doing, as it may help (its quite well commented as im meant to be doing this as a demo to someone and cant get the thing working myself!!!)