Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Querying Access Database from Flash

Posted on 2004-03-28
5
Medium Priority
?
147 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 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.
Suggested Courses

618 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