Hi guys!
I'm wondering how would I use Flash AS3.0 to connect to SQL Server and read from a table in a data base into a string or an array for use within flash.
Thank you!
Printable View
Hi guys!
I'm wondering how would I use Flash AS3.0 to connect to SQL Server and read from a table in a data base into a string or an array for use within flash.
Thank you!
You mean "MYSQL"?
No, actually I mean SQL Server... as in Microsoft SQL Server 2005...
Thread moved to "Scripting and Backend".
Typically you won't interface with the database directly. It is possible with AS3 now, but I don't know if there is a class written for SQL server. I know there is one for MySQL out there somewhere.
You should write a server-side script to do the database work, and have it spit back XML for you to digest in Flash. If you're on a Microsoft server, you're probably in a .NET environment. .NET and SQL is not in my expertise at all, so I can't point you in any further direction. I tend to use as many open source technologies as possible. :)
Thanks, I'm an expert in .NET and ASP, although I need to focus on Flash ATM, so that's why I'm asking... So you're telling me there is no way for AS3 to interface directly with SQL server? I've been browsing a lot online, but I see nothing, and I really do not want to hard code values into the flash project...
For a real crude example since I don't know .NET or ASP, this is about how it would work:
Flash makes a request out to dosomething.aspx. POSTs variables or whatnot. Then dosomething.aspx will query the database and render the results as XML. Then Flash just handles the result as a normal XML file.
Well I was making a post but it seems it didn't go through... :\
I was thinking about a simple question:
How would you tell flash that the query to the database is complete and that the XML file is ready for use?
I found a caveman solution to the problem, but it is not as kusher as I would like it to be... Read the file in flash until you read a known variable which marks a successful transaction, such as <success>success</success>. I don't like the idea of possible infinite loops, so I'm wondering if Flash has a function I, The New Guy, don't know about...
Thanks a lot...
That's not even an issue. It's not like the bytes are streaming into Flash one by one, and the characters are being assembled as your code executes. Just listen for the Event.COMPLETE for your URLLoader object, and you're good to go.