Solved

Querying Access Database from Flash

Posted on 2004-03-28
5
145 Views
Last Modified: 2010-04-03
Hi,

I am trying to set up a simple page that uses Flash and ASP to display information from the Microsoft Access database. I would appreciate if somebody can give me instructions (samples) how to create a Flash file, Database and ASP page to do it.

Thanks a lot.
0
Comment
Question by:kirylm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
rascalpants earned 250 total points
ID: 10704976
your data output on the ASP page needs to be displayed in the following format:

variable1=value1&variable2=value2&variable3=value3&

or like this:

name=Bob&phone=555-5555&email=bob@aol.com&


you do this by using similar ASP code like the below:

<%
dim MyConn, SQL_query, rs
dim name, phone, email
 
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.open "Provider=SQLOLEDB;Data Source=DATABASENAME;Initial Catalog=CATALOGNAME;uid=USERNAME;pwd=PASSWORD"
SQL_query = "SELECT * FROM tableName"
Set rs = server.createobject("ADODB.Recordset")
rs.open SQL_query,MyConn,1,2


screen_no = 1
WHILE NOT rs.EOF

response.write "name="& rs("name") &"&phone="& rs("phone") &"&email="& rs("email") &"&"

rs.MoveNext
WEND
%>


then in the first frame of your movie, you put this LoadVars code there:


myData = new LoadVars();
myData.onLoad = function(success){
  if(success){
    _root.name = myData.name;
    _root.phone = myData.phone;
    _root.email = myData.email;
  } else {
    trace("error");
  }
};

myData.sendAndLoad("variablesPage.asp", myData, "POST");


then you just use the variables that are in the root of the movie and display then when you want.....


if you need more help, let me know...

rp
0
 

Expert Comment

by:scotman23
ID: 10715900
you can do it without the loadvars method. On the ASP page where you will have the flash file.... in the source code just enter the values where it calls in the flash file. e.g.

source="myfile.swf?<%=Response.Write "name="& rs("name") &"&phone="& rs("phone") &"&email="& rs("email") &"&">"

this will pass the variables directly in to _level0 of your movie for you to use
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 10724229
the LoadVars() method is preferred because of a few different reasons...

- you page and movie will load faster because the data is not called until needed

- and because you can control when the data is loaded, you can move the code to other parts of the movie or place use it with a button to load the data.

- you have much better control over your data by loading it into an Object

- you can also create a preloader based on the properties of that Object which are more accurate

- your variables from your database are not displayed in the source code of the html(slight security risk)


...bandwidth is still a problem for a lot of users, and unless you are only passing a very small amount of data to the movie, then you should wait to load it when it is needed.  The same theory applies to sections of a movie as well, and should be loaded at runtime if possible.

since we don't have much to go on from the question details, you should assume that the amount of data being passed is enough to slow down the loading of the movie, and that some of the data could be private in nature...

I use your(scotman23) method quite a bit when I am only passing 2 or 3 variables, but when I want to pass more data, I want to have it load only when I need it...

rp
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question