a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

ASP query to ACCESS and back in XML to Flash?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> ASP query to ACCESS and back in XML to Flash?
Page: [1]
 
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
ASP query to ACCESS and back in XML to Flash? - 10/15/2005 16:20:43   
Hi,

I'm having a problem with the following code, basically I am querying an Access db to populate a dropdown list box with names.
I then pass a numeric value from the form to query the database for the results I need.
The results is returned as XML then a Flash slideshow reads the XML to display the images.

I have put all the code into one file as shown below, but the xml gets printed on the page, so that is not right.

I tried posting from the form to another page, but that just prints the xml in the browser.

If I create an XML from the results and just point the slideshow at that it displays the images just fine. However, I need this to be dynamic.

any ideas on how I can go about this?


many thanks, Rob.


<%@LANGUAGE = VBScript%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>slideshow</title>
</head>

<link rel="stylesheet" type="text/css" href="css/ir.css">
<body id="bod">


<% 
	Dim oConn1, oRS1, strSQL1 

	Set oConn1 = Server.CreateObject("ADODB.Connection") 
	Set oRS1 = Server.CreateObject("ADODB.Recordset") 

	oConn1.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")

	strSQL1="SELECT Photographer.photogID, Photographer.Fullname FROM Photographer ORDER BY Photographer.Fullname;" 

	oRS1.Open strSQL1, oConn1, 2, 3 
%>
<form method="POST" action="ch20_01.asp" name="Form1">
	<select name="Photographer" size="1" onchange="Form1.submit()" id="Dropdown1">
	<option>Select a Photographer</option>
	<%Do While Not oRS1.EOF %>
	<option value="<%=oRS1("PhotogID")%>"><%=oRS1("Fullname")%></option>
	<%oRS1.MoveNext
Loop%></select>
</form>
<%
	oRS1.Close 
	Set oRS1 = Nothing
	
	oConn1.Close 
	Set oConn1 = Nothing 
%>

<% 
IF Request.Form("Photographer") = "" Then 
Else 
%>

<?xml version="1.0" encoding="UTF-8"?> 

<gallery>

	<album title="General Images" description="Images from the Gen Database" lgPath="dib/gen_dib_data/images/" tnPath="dib/gen_dib_data/thumbs/" tn="dib/gen_dib_data/thumbs/ab_0001.jpg" /> 

<% 
	Dim oConn2, oRS2, strSQL2 

	Set oConn2 = Server.CreateObject("ADODB.Connection") 
	Set oRS2 = Server.CreateObject("ADODB.Recordset") 

	oConn2.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")

	strSQL2="SELECT Photo.Filename, Photo.PDesc, Photo.PhotoID, Photo.PhotogID, Photographer.Fullname FROM Photo INNER JOIN Photographer ON Photo.PhotogID = Photographer.photogID WHERE (((Photo.PhotogID)=" & request("Photographer") & ")) ORDER BY Photo.PhotoID;" 

	oRS2.Open strSQL2, oConn2, 2, 3 
	Do While Not oRS2.EOF 
%> 

<img src="<%=oRS2("Filename")%>" caption="GE-<%=oRS2("PhotoID")%> __________ <%=oRS2("PDesc")%> __________ by <%=oRS2("Fullname")%>" /> 

<% 
	oRS2.MoveNext 
	Loop 
 
	oRS2.Close 
	Set oRS2 = Nothing
	
	oConn2.Close 
	Set oConn2 = Nothing 
%></gallery><%END IF%>


<div style="border:1px solid #51606F; position: absolute; width: 100px; height: 100px; z-index: 1; left:278px; top:105px" id="layer1">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="465" height="490" id="slideshow" align="middle">
<param name="FlashVars" value="xmlfile=ch20_01.asp" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="slideshow.swf" />
<param name="quality" value="Best" />
<param name="bgcolor" value="#ffffff" />
<param name="menu" value="false">
<param name="wmode" value="transparent">
<embed src="slideshow.swf" FlashVars="xmlfile=ch20_01.asp" quality="Best" bgcolor="#ffffff" width="465" height="490" name="slideshow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" wmode="transparent" />
</object>
</div>

</body>

</html>
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/16/2005 14:13:13   
quote:

<param name="FlashVars" value="xmlfile=ch20_01.asp" />


I think the prob is right there. You're telling Flash to go to an asp page to find the XML but you're trying to include the stuff on the current page by writing it to the page. Even if it is the same page, that won't quite work but your thinking is sound. What you need to do is 1 of 2 things:

1. Make the xml really it's own ASP file. That's not hard to do dynamically. You just want the ASP code on that page to return valid XML and only XML. In fact, you can take an example file copy and rename it to the .asp file and test it. Anything else other than XML data and it generally won't work. Flash is expecting valid XML on that page and nothing else.

2. Turn the XML you have on the current page into a variable and pass the variable to Flash as XML. Again, only pass XML to Flash. I'd do it something like so:

IF Request.Form("Photographer") = "" Then
Else
DIM myXMLData
myXMLData = ""

myXMLData = myXMLData &"<?xml version="&CHR(034)&"1.0"&CHR(034)&" encoding="&CHR(034)&"UTF-8"&CHR(034)&"?>"

myXMLData = myXMLData &"<gallery>"

....

and your db writing would look similar as well. The idea here again is to make the variable contain only XML data when we pass it. Using a variable has the advantage that you can response.write stuff along the way to see what the output was at certain points along the way.

Either way you want that XML (either variable or external .asp file) to be structurally exactly like the application expects. Usually you can tell by any example files.

I have a similar application where I send XML data to a charting application and that was the main place that I had problems.

That any help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/16/2005 16:17:07   
many thanks for your reply and the tutorial, I have put together the code as per your example and all seems to work fine apart from one line I can't get to work:-

myXMLData = myXMLData &"<img src="&CHR(034)&"<%=oRS2("&CHR(034)&"Filename"&CHR

I think the characters <%= are causing the problem, do I have to use chr codes to get round that?

cheers Rob.


<%
	DIM myXMLData 
	myXMLData = "" 
	myXMLData = myXMLData &"<?xml version="&CHR(034)&"1.0"&CHR(034)&" encoding="&CHR(034)&"UTF-8"&CHR(034)&"?>" 
	myXMLData = myXMLData &"<gallery>" 
	myXMLData = myXMLData &"<album title="&CHR(034)&"General Images"&CHR(034)&" description="&CHR(034)&"Images from the Gen Database"&CHR(034)&" lgPath="&CHR(034)&"dib/gen_dib_data/images/"&CHR(034)&" tnPath="&CHR(034)&"dib/gen_dib_data/thumbs/"&CHR(034)&" tn="&CHR(034)&"dib/gen_dib_data/thumbs/ab_0001.jpg"&CHR(034)&">" 
%>

<%
	Dim oConn2, oRS2, strSQL2 
	Set oConn2 = Server.CreateObject("ADODB.Connection") 
	Set oRS2 = Server.CreateObject("ADODB.Recordset") 
	oConn2.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")
	strSQL2="SELECT Photo.Filename, Photo.PDesc, Photo.PhotoID, Photo.PhotogID, Photographer.Fullname FROM Photo INNER JOIN Photographer ON Photo.PhotogID = Photographer.photogID WHERE (((Photo.PhotogID)=12)) ORDER BY Photo.PhotoID;" 
	oRS2.Open strSQL2, oConn2, 2, 3 
	Do While Not oRS2.EOF 
%>

<%
	myXMLData = myXMLData &"<img src="&CHR(034)&"<%=oRS2("&CHR(034)&"Filename"&CHR(034)&")%>"&CHR(034)&" caption="&CHR(034)&"GE-<%=oRS2("&CHR(034)&"PhotoID"&CHR(034)&")%> __________ <%=oRS2("&CHR(034)&"PDesc"&CHR(034)&")%> __________ by <%=oRS2("&CHR(034)&"Fullname"&CHR(034)&")%>"&CHR(034)&" />"
%>


<%
	oRS2.MoveNext 
	Loop 
 
	oRS2.Close 
	Set oRS2 = Nothing
	
	oConn2.Close 
	Set oConn2 = Nothing 
%><%	
	myXMLData = myXMLData &"</album>" 
	myXMLData = myXMLData &"</gallery>" 
	Response.write myXMLData
%>


(in reply to RobM_01)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/16/2005 20:25:36   
quote:

I think the characters <%= are causing the problem,


Yup, they sure are. That can get a little confusing with all the double quote crap going on. See, the confusion sets on 'cause we only want to send the CHR(034) when we want to include a double quote in the actual XML code and *not* the asp code.

Confused yet? :)

So to produce XML output with your database values, sometimes we use a CHR(034) and sometimes we use a double quote.

1. We use a double quote when we want to delimit text in asp.

2. We use a CHR(034) when we want to send the XML sata a double quote.

So keeping those rules in mind, we want that line you're trying to do look like so:

myXMLData = myXMLData &"<img src="&CHR(034)&oRS2("Filename")&CHR(034)&">"&....

That would send the XML data a string like so:

<img src="image.gif">

Does that help at all?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 4:39:25   
thanks, it's working just fine now. I have contacted the people at www.slideshowpro.net to find out how I go about reading the variable I tried using the following method but nothing appeared.

<param name="FlashVars" value="xmlfile=myXMLData" />
<embed src="slideshow.swf" FlashVars="xmlfile=myXMLData" ……..

so maybe there is another way, if that works then I will be abale to throw any kind of query at it, should be quite cool.

anyway, many thanks again for your time and excellent tutes :)

cheers Rob.



here is the complete code if anyone else needs it.


<%@LANGUAGE = VBScript%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>slideshow</title>
</head>

<link rel="stylesheet" type="text/css" href="css/ir.css">
<body id="bod">
<% 
	Dim oConn1, oRS1, strSQL1 

	Set oConn1 = Server.CreateObject("ADODB.Connection") 
	Set oRS1 = Server.CreateObject("ADODB.Recordset") 

	oConn1.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")

	strSQL1="SELECT Photographer.photogID, Photographer.Fullname FROM Photographer ORDER BY Photographer.Fullname;" 

	oRS1.Open strSQL1, oConn1, 2, 3 
%>
<form method="POST" action="Default.asp" name="Form1">
	<select name="Photographer" size="1" onchange="Form1.submit()" id="Dropdown1">
	<option>Select a Photographer</option>
	<%Do While Not oRS1.EOF %>
	<option value="<%=oRS1("PhotogID")%>"><%=oRS1("Fullname")%></option>
	<%oRS1.MoveNext
Loop%></select>
</form>
<%
	oRS1.Close 
	Set oRS1 = Nothing
	
	oConn1.Close 
	Set oConn1 = Nothing 
%>

<% 
IF Request.Form("Photographer") = "" Then 
Else 
%> 
<%
	DIM myXMLData 
	myXMLData = "" 
	myXMLData = myXMLData &"<?xml version="&CHR(034)&"1.0"&CHR(034)&" encoding="&CHR(034)&"UTF-8"&CHR(034)&"?>" 
	myXMLData = myXMLData &"<gallery>" 
	myXMLData = myXMLData &"<album title="&CHR(034)&"General Images"&CHR(034)&" description="&CHR(034)&"Images from the Gen Database"&CHR(034)&" lgPath="&CHR(034)&"dib/gen_dib_data/images/"&CHR(034)&" tnPath="&CHR(034)&"dib/gen_dib_data/thumbs/"&CHR(034)&" tn="&CHR(034)&"dib/gen_dib_data/thumbs/ab_0001.jpg"&CHR(034)&">" 
%>

<%
	Dim oConn2, oRS2, strSQL2 
	Set oConn2 = Server.CreateObject("ADODB.Connection") 
	Set oRS2 = Server.CreateObject("ADODB.Recordset") 
	oConn2.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")
	strSQL2="SELECT Photo.Filename, Photo.PDesc, Photo.PhotoID, Photo.PhotogID, Photographer.Fullname FROM Photo INNER JOIN Photographer ON Photo.PhotogID = Photographer.photogID WHERE (((Photo.PhotogID)=" & request("Photographer") & ")) ORDER BY Photo.PhotoID;" 
	oRS2.Open strSQL2, oConn2, 2, 3 
	Do While Not oRS2.EOF 
%>

<%
	myXMLData = myXMLData &"<img src="&CHR(034)&oRS2("Filename")&CHR(034)&" caption="&CHR(034)& "GE-" & oRS2("PhotoID")& "            "& oRS2("PDesc") & "            by "& oRS2("Fullname")&CHR(034)&" />"
%>


<%
	oRS2.MoveNext 
	Loop 
 
	oRS2.Close 
	Set oRS2 = Nothing
	
	oConn2.Close 
	Set oConn2 = Nothing 
%><%	
	myXMLData = myXMLData &"</album>" 
	myXMLData = myXMLData &"</gallery>" 
%>

<%END IF%>

<div style="border:1px solid #51606F; position: absolute; width: 100px; height: 100px; z-index: 1; left:278px; top:105px" id="layer1">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="465" height="490" id="slideshow" align="middle">
<param name="FlashVars" value="xmlfile=myXMLData" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="slideshow.swf" />
<param name="quality" value="Best" />
<param name="bgcolor" value="#ffffff" />
<param name="menu" value="false">
<param name="wmode" value="transparent">
<embed src="slideshow.swf" FlashVars="xmlfile=myXMLData" quality="Best" bgcolor="#ffffff" width="465" height="490" name="slideshow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" wmode="transparent" />
</object>
</div>
</body>

</html>

(in reply to RobM_01)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 9:03:10   
quote:

<embed src="slideshow.swf" FlashVars="xmlfile=myXMLData"


Have you tried this:

<embed src="slideshow.swf" FlashVars="xmlfile=" & myXMLData...

Remember you're passing a variable. But probably there is a different syntax as in:

<embed src="slideshow.swf" FlashVars="xmldata="myXMLData...

but it's probably specific to that Flash app.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 9:14:01   
I checked the component in Flash and there is a single line that say's
ssp.xmlfilepath=xmlfile

I could not find another variant apart from
instanceName.xmlFileType which I think is for opml

I was hoping to find an xmldata or something along those lines.

I try your suggestion, unfortunately no joy.

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 9:20:46   
Well then the alternative is not that difficult. Take the code that builds the variable and put it on it's own ASP page and just response.write the variable as the last item on the page. Nothing else should be sent to the browser with that page (no <html> tags or anything) and save it as myXMLbuilder.asp or something like that.

Then change the calling line to:

<param name="FlashVars" value="xmlfile=myXMLbuilder.asp" />

(or whatever you named the file.)

That should not take too long to do. That work any better?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 9:35:33   
After executing default.asp I just get sent along to myXMLbuilder.asp page which if I view source I can see the xml.

do I need the slideshow on that page also?




Default.asp

<%@LANGUAGE = VBScript%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>slideshow</title>
</head>

<link rel="stylesheet" type="text/css" href="css/ir.css">
<body id="bod">
<% 
	Dim oConn1, oRS1, strSQL1 

	Set oConn1 = Server.CreateObject("ADODB.Connection") 
	Set oRS1 = Server.CreateObject("ADODB.Recordset") 

	oConn1.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")

	strSQL1="SELECT Photographer.photogID, Photographer.Fullname, Count(Photo.Filename) AS CountOfFilename FROM Photographer INNER JOIN Photo ON Photographer.photogID = Photo.PhotogID GROUP BY Photographer.photogID, Photographer.Fullname ORDER BY Photographer.Fullname;" 

	oRS1.Open strSQL1, oConn1, 2, 3 
%>
<form method="POST" action="myXMLbuilder.asp" name="Form1">
	<select name="Photographer" size="1" onchange="Form1.submit()" id="Dropdown1">
	<option>Select a Photographer</option>
	<%Do While Not oRS1.EOF %>
	<option value="<%=oRS1("PhotogID")%>"><%=oRS1("Fullname")%> ...... (<%=oRS1("CountOfFilename")%>) images</option>
	<%oRS1.MoveNext
Loop%></select>
</form>
<%
	oRS1.Close 
	Set oRS1 = Nothing
	
	oConn1.Close 
	Set oConn1 = Nothing 
%>


<div style="border:1px solid #51606F; position: absolute; width: 100px; height: 100px; z-index: 1; left:278px; top:105px" id="layer1">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="465" height="490" id="slideshow" align="middle">
<param name="FlashVars" value="xmlfile=myXMLbuilder.asp" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="slideshow.swf" />
<param name="quality" value="Best" />
<param name="bgcolor" value="#ffffff" />
<param name="menu" value="false">
<param name="wmode" value="transparent">
<embed src="slideshow.swf" FlashVars="myXMLbuilder.asp" quality="Best" bgcolor="#ffffff" width="465" height="490" name="slideshow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" wmode="transparent" />
</object>
</div>
</body>

</html>


myXMLbuilder.asp

<%@LANGUAGE = VBScript%>

<% 
IF Request.Form("Photographer") = "" Then 
Else 
%> 
<%
	DIM myXMLData 
	myXMLData = "" 
	myXMLData = myXMLData &"<?xml version="&CHR(034)&"1.0"&CHR(034)&" encoding="&CHR(034)&"UTF-8"&CHR(034)&"?>" 
	myXMLData = myXMLData &"<gallery>" 
	myXMLData = myXMLData &"<album title="&CHR(034)&"General Images"&CHR(034)&" description="&CHR(034)&"Images from the Gen Database"&CHR(034)&" lgPath="&CHR(034)&"dib/gen_dib_data/images/"&CHR(034)&" tnPath="&CHR(034)&"dib/gen_dib_data/thumbs/"&CHR(034)&" tn="&CHR(034)&"dib/gen_dib_data/thumbs/ab_0001.jpg"&CHR(034)&">" 
%>

<%
	Dim oConn2, oRS2, strSQL2 
	Set oConn2 = Server.CreateObject("ADODB.Connection") 
	Set oRS2 = Server.CreateObject("ADODB.Recordset") 
	oConn2.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")
	strSQL2="SELECT Photo.Filename, Photo.PDesc, Photo.PhotoID, Photo.PhotogID, Photographer.Fullname FROM Photo INNER JOIN Photographer ON Photo.PhotogID = Photographer.photogID WHERE (((Photo.PhotogID)=" & request("Photographer") & ")) ORDER BY Photo.PhotoID;" 
	oRS2.Open strSQL2, oConn2, 2, 3 
	Do While Not oRS2.EOF 
%>

<%
	myXMLData = myXMLData &"<img src="&CHR(034)&oRS2("Filename")&CHR(034)&" caption="&CHR(034)& "GE-" & oRS2("PhotoID")& "            "& oRS2("PDesc") & "            by "& oRS2("Fullname")&CHR(034)&" />"
%>


<%
	oRS2.MoveNext 
	Loop 
 
	oRS2.Close 
	Set oRS2 = Nothing
	
	oConn2.Close 
	Set oConn2 = Nothing 
%><%	
	myXMLData = myXMLData &"</album>" 
	myXMLData = myXMLData &"</gallery>" 
%>

<%END IF%>
<%response.write myXMLData%>

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 9:43:54   
quote:

<form method="POST" action="myXMLbuilder.asp" name="Form1">


Is that supposed to be posting to default.asp?

I apologize but I'm not familiar with this specific Flash app. Your page myXMLbuilder.asp looks like it's supposed to tho.

I've been doing this type of thing a lot lately (sharing data w/ XML) and that external ASP page should be building the XML data just fine.

As to where the form posts, are you working from an example file? If so, where does the example file post?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 9:58:50   
the default.asp page queries my database for photographer names to populate the list box and each has a unique id.

The form on the default.asp posts the id to myXMLbuilder.asp that queries the database again that grabs the results filenames descriptions and photoid for that particular photographer and produces the xml. thats it.

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 11:33:54   
Did you review the instructions here:

http://www.slideshowpro.net/tut_dynamic_xml.php

regarding "Set-up movie to receive variable"?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 11:53:34   
I did and I think I have followed it correctly, I have just downloaded their user guide to see if there is anything in there that I may have missed.

Cheers Rob.

(in reply to rdouglass)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 12:11:45   
is it possible to write the xml to a temporary file and just point ssp to that - or would that be a problem when multiple users view the same page?

(in reply to RobM_01)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/17/2005 13:00:33   
quote:

is it possible to write the xml to a temporary file and just point ssp to that - or would that be a problem when multiple users view the same page?


I was just exploring that possibility. Should not be a problem tho if write priv's are OK.

Question: Do you have any directories / options with your host for visitor uploads or any other directory where the browser has write priviledges? Writing the file out is no biggie as long as we have the appropriate priviledges.

And we can fix it so that each user creates a new file.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/18/2005 5:27:34   


I recieved this message from the guys who built the Slideshowpro component:

"I see. Yes, whatever you place in FlashVars is passed into the Flash movie *literally*, so it thinks your variable name is the data.
You'll need to write the file or variable value."

I'm not sure if I want to write files, what would happen if a thousand users were to log in at the same time, (chance would be a fine thing :)) could the site start having problems?

anyway, in the meantime I tried this but again nothing appears
<param name="FlashVars" value="xmlfile=<%=Server.HTMLEncode( myXMLData )%>" />

.and the same for the embed tag one.

(not sure if I need the brackets or not )



(in reply to rdouglass)
RobM_01

 

Posts: 135
Joined: 1/1/2004
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/19/2005 17:03:03   
Finaly cracked it!!!

Ok - to start with I have this first file called Default.asp, which I load and it produces a dropdown list box populated with photographer names.
If I click on a name it posts the unique id back to Default.asp and then stores it in a variable.

this variable is added to the flashvars along with a file name
"xmlfile=Photog.asp?ID=<%=PhotogID%>" />

which is picked up by the Photog.asp that adds the number to the query that grabs the records for that photographer and outputs as xml and displays the images.

and there you have it.

So, many thanks for your time and expert advice, very much appreciated.

Cheers Rob.

<%@LANGUAGE = VBScript%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>slideshow</title>
</head>

<body>
<%
    Dim oConn1, oRS1, strSQL1 
    Set oConn1 = Server.CreateObject("ADODB.Connection") 
    Set oRS1 = Server.CreateObject("ADODB.Recordset") 
    oConn1.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")
    strSQL1="SELECT Photographer.photogID, Photographer.Fullname, Count(Photo.Filename) AS CountOfFilename FROM Photographer INNER JOIN Photo ON Photographer.photogID = Photo.PhotogID GROUP BY Photographer.photogID, Photographer.Fullname ORDER BY Photographer.Fullname;" 
    oRS1.Open strSQL1, oConn1, 2, 3 
%>
<form method="POST" action="Default.asp" name="Form1">
    <select name="Photographer" size="1" onchange="Form1.submit()" id="Dropdown1">
    <option>Select a Photographer</option>
    <%Do While Not oRS1.EOF %>
    <option value="<%=oRS1("PhotogID")%>"><%=oRS1("Fullname")%></option>
    <%oRS1.MoveNext
Loop
%>

</select>
</form>
<%
    oRS1.Close 
    Set oRS1 = Nothing
    
    oConn1.Close 
    Set oConn1 = Nothing 
%>

<% 
IF Request.Form("Photographer") = "" Then 
Else 
Dim PhotogID
PhotogID=Request.Form("Photographer")
%>



<div style="border:1px solid #51606F; position: absolute; width: 100px; height: 100px; z-index: 1; left:278px; top:105px" id="layer1">
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="465" height="490" id="slideshow" align="middle">
        <param name="FlashVars" value="xmlfile=Photog.asp?ID=<%=PhotogID%>" />
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="movie" value="slideshow.swf" />
        <param name="quality" value="Best" />
        <param name="bgcolor" value="#ffffff" />
        <param name="menu" value="false">
        <param name="wmode" value="transparent">
        <embed src="slideshow.swf" flashvars="xmlfile=Photog.asp?ID=<%=PhotogID%>" quality="Best" bgcolor="#ffffff" width="465" height="490" name="slideshow" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" wmode="transparent" />
        
    </object>
</div>
<%END IF%>

</body>

</html>








Photog.asp

<%@LANGUAGE = VBScript%>

<%
DIM Photographer 
Photographer = Request.querystring("ID")

    DIM myXMLData 
    myXMLData = "" 
    myXMLData = myXMLData &"<?xml version="&CHR(034)&"1.0"&CHR(034)&" encoding="&CHR(034)&"UTF-8"&CHR(034)&"?>" 
    myXMLData = myXMLData &"<gallery>" 
    myXMLData = myXMLData &"<album title="&CHR(034)&"General Images"&CHR(034)&" description="&CHR(034)&"Images from the Gen Database"&CHR(034)&" lgPath="&CHR(034)&"dib/gen_dib_data/images/"&CHR(034)&" tnPath="&CHR(034)&"dib/gen_dib_data/thumbs/"&CHR(034)&" tn="&CHR(034)&"dib/gen_dib_data/thumbs/ab_0001.jpg"&CHR(034)&">" 
%>

<%
    Dim oConn, oRS, strSQL 
    Set oConn = Server.CreateObject("ADODB.Connection") 
    Set oRS = Server.CreateObject("ADODB.Recordset") 
    oConn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("dib/gen_dib_data/gen_dib_data.mdb")
    strSQL="SELECT Photo.Filename, Photo.PDesc, Photo.PhotoID, Photo.PhotogID, Photographer.Fullname FROM Photo INNER JOIN Photographer ON Photo.PhotogID = Photographer.photogID WHERE (((Photo.PhotogID)=" & Photographer & ")) ORDER BY Photo.PhotoID;" 
    oRS.Open strSQL, oConn, 2, 3 
    Do While Not oRS.EOF 
%>

<%
    myXMLData = myXMLData &"<img src="&CHR(034)&oRS("Filename")&CHR(034)&" caption="&CHR(034)& "GE-" & oRS("PhotoID")& " - "& oRS("PDesc") & " - by "& oRS("Fullname")&CHR(034)&" />"
%>

<%
    oRS.MoveNext 
    Loop 

    oRS.Close 
    Set oRS = Nothing
    
    oConn.Close 
    Set oConn = Nothing 
%>
<%    
    myXMLData = myXMLData &"</album>" 
    myXMLData = myXMLData &"</gallery>" 
%>
<%
Response.Write myXMLData
%>




I have posted the test online if you want to see the results

http://www.imagerealm.co.uk/test1.asp

Cheers Rob.

(in reply to RobM_01)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: ASP query to ACCESS and back in XML to Flash? - 10/20/2005 8:57:02   
quote:

"xmlfile=Photog.asp?ID=<%=PhotogID%>" />


I shoulda' thought of the querystring. :) Nice catch. I'll remember that one.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to RobM_01)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> ASP query to ACCESS and back in XML to Flash?
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts