Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-16-2002, 11:29 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default [quote]Populating an Array with database data

move360 say:
Quote:

I am evaluating SWFkit and specifically looking to use it for a Access database application. I would like to populate an array with data from a database. Can you post a quick example of this? For example here is a simple Select statement.

record = conn.Execute("Select name from table1 where available = 1");

I would like to place the data into an array in Flash.

Thanks,

Move360

Reply With Quote
  #2 (permalink)  
Old 12-16-2002, 11:30 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Populating an Array with database data

move360 say:
Quote:
I guess to answer my own question, record would actaully be my array and I would just need to use the AcitveX functions to access what I need. Is this correct?

I see that in the database example I downloaded from your site.

But here is another questions. Let's take the Select I posted before:

record = conn.Execute("Select name from table1 where available = 1");

Let's say I have 10 records returned that all have available=1. They are Ed, Mike, Jim, Terry, Ray, Fred, Amy, Jill, Terra, Marlee.

Now to display the first one is pretty easy and I see that in your example. I could do something like this.

FlashPlayer.bindData("Name");

But what if I have 3 fields in my SWF. They are Name1, Name2, and Name3.

I want to show the first 3 names that were returned from the Select.

How can this be done?
Reply With Quote
  #3 (permalink)  
Old 12-16-2002, 11:31 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Populating an Array with database data

move360 say:
Quote:

Okay, looking at the ADODB ActiveX functions there is no way to do what I need.

So, the only solution would be to get the record from my SELECT....

record = conn.Execute("Select name from table1 where available = 1");

...into an array in Flash.

Any ideas?
Reply With Quote
  #4 (permalink)  
Old 12-16-2002, 11:38 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Maybe,you can do it like this

if you want to show the first 3 names,just select the first 3 record,and join them into a String object,then bind the String to swf.

FFish Script:
Code:
FlashPlayer.bindData("names");
record = conn.Execute("Select name from table1 where available = 1");
record.MoveFirst();
var names = record.Fields(1).Value.toString();
for (i = 0; i < 2; i ++)
{
  record.MoveNext();
  names += "||" + record.Fields(1).Value.toString();
}
FlashPlayer.names = names;
FlashPlayer.updateData(false);

in the actionscript:

Code:
var names;
yourArray = new Array();
yourArray = names.split("||");
Reply With Quote
  #5 (permalink)  
Old 12-16-2002, 11:39 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Populating an Array with database data

move360 say:

Quote:
Thanks. I will give this a try.

Cheers.

Reply With Quote
  #6 (permalink)  
Old 12-16-2002, 11:40 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: [quote]Populating an Array with database data

move360 say:

Quote:
I have not been able to get this to work. Does the SWFkit have any suggestions?
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:09 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.