A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Actionscript 3.0 and Microsoft Access or Databases

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    7

    Actionscript 3.0 and Microsoft Access or Databases

    Hello All,

    I have a question that I have needed help with for a while now and still cannot figure out. I have a local Microsoft Access Database and I would like to connect it to my flash project to dynamically load information. My company I work for does not use any kind of software except for .NET. I am at a loss because everything I find can't be used with Microsoft Access. Any help would be very appreciated. Thanks.

    NateTheGreat

  2. #2
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,929
    I don't think using flash stand-alone will accomplish what you want, but you can use SWF Studio to create an exe that will allow you to interact with an Access db almost however you want.
    I've always been very pleased with their functionality and support.

    Hope that helps!
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    7
    Amazing thanks so much! My boss actually asked me if flash was the only way to go about projects so hopefully the SWF Studio will be a better fit. Thanks again!

    NateTheGreat

  4. #4
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,929
    SWF Studio actually creates an exe using a flash built swf file, but it provides a TON of features that are not available natively in flash, such as system calls, db connections, etc.

    Take a look at their site, you can download the trial version which is fully functional, but the exe files that it creates only work for a few days.

    northcode.com

    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  5. #5
    Junior Member
    Join Date
    Dec 2009
    Posts
    7
    Ok....So I have downloaded the SWF Studio as instructed and I got everything to program to run smoothly, but for some reason I cannot get the code to work right. I have been trying to link a simple Access Database to a basic flash document to just read one field of information and set it to a text field to view. I am just trying to see if I can get it to work. Now, here is my code so far.....

    open_btn.addEventListener(MouseEvent.CLICK,openStu ff);
    function openStuff():void
    {
    ssCore.ADO.setConnectString({connectString:"Provid er=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False; Data Source="+ssGlobals.ssStartDir+"\\Example.mdb;"});
    ssCore.ADO.open();
    ssCore.ADO.setWhere({clause:"Rank = 1"});
    ssCore.ADO.setTable({name:"2004 Billionaires"});
    var return_obj = ssCore.ADO.execSQL({sql:"SELECT Name"});
    textField1.text = return_obj.result.toString();
    ssCore.ADO.close();
    }

    Can anyone help me figure out why when I run this it doesn't do anything? It builds fine and runs ok, but when I click the button nothing happens. Thanks in advance.

    NateTheGreat

  6. #6
    anyone else hear that? flashpipe1's Avatar
    Join Date
    Jan 2003
    Location
    Upstate NY
    Posts
    1,929
    northcode? you around to help with this?? I haven't done anything with Access db and SWF Studio myself...

    nate, if he doesn't reply to this post, you can probably shoot him a PM. He's generally VERY good about helping out with all SWF Studio related stuff and has answered SOO many of my questions and helped me out with stuff from super basic stupid things I was doing wrong to some fairly complex solutions...
    He might be on break for New Years, but I don't think they give him any vacation over there...
    Love like you've never been hurt, live like there's no tomorrow and dance like nobody's watching.

  7. #7
    Junior Member
    Join Date
    Dec 2009
    Posts
    7
    Thanks once again!! I will contact him via PM and see what he says. Many thanks.

    Nate

  8. #8
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,764
    I see a couple of problems...

    #1 - You're calling ADO.open before you've told the ADO plugin what table you want to open and what data you want from it.

    #2 - You can use setWhere/setTable/etc OR execSQL but they can't be used together. execSQL gives you direct control over the SQL query, the other methods allow you to define your query without using SQL.

    #3 I dont' see where you enabled synchronous commands (ssDefaults.synchronousCommands = true). When we released SWF Studio 3.0 everything was async. When we added support for sync calls we didn't wan to break existing code so we added ssDefaults to let you change the default call mode.

    Here's a little example that shows how to pull data from an Access database. The output is sent to the SWF Studio Trace Tab but you can do whatever you want with it once you have it in Flash. It's in AS2 but it will be very easy to pull the calls you need into your AS3 project.
    Attached Files Attached Files

  9. #9
    Junior Member
    Join Date
    Dec 2009
    Posts
    7

    Code

    Hello Northcode,

    Thanks very much for the reply. The code you sent worked at first but once I tried the code in my project as seen below, both stopped getting data from the Database. Here is my code thus far...


    openbtn.addEventListener(MouseEvent.CLICK,openStuf f);
    function openStuff(e:MouseEvent):void
    {
    ssCore.init();
    ssDefaults.synchronousCommands = true;
    ssCore.ADO.setConnectString({connectString:"Provid er=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False; Data Source="+ssGlobals.ssStartDir+"\\Example.mdb;"});
    ssCore.ADO.setSQL({sql:"select * from [2004 Billionaires] where Rank = '1'"});
    var return_obj = ssCore.ADO.open();

    if (return_obj.success)
    {
    return_obj = ssCore.ADO.getRows();

    if (return_obj.success)
    {
    ssDebug.trace(return_obj.result);
    }
    else
    {
    ssDebug.trace("ADO.getRows ERROR: "+return_obj.Error.description);
    }
    }
    else
    {
    ssDebug.trace("ADO.open ERROR: "+return_obj.Error.description);
    ssDebug.trace(" adoError: "+return_obj.adoError);
    }
    }


    Any help again? Ive even tried extracting the winzip to another folder and build again and still doesnt work now. Thanks for any help.


    Nate

  10. #10
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,764
    It should work where you have it now, but the calls to ssCore.init and to set ssDefaults flag should really only be done once at the beginning of your application.

    I'm guessing that the space in "Provid er=Microsoft.Jet.OLEDB.4.0;" is something that the forums are doing, but just in case.. it should not be there, it should be "Provider=...".

    If you want to send your FLA and SPF to [email protected] I'll have a look at it for you (assuming you're using the same MDB file I sent you for testing).

  11. #11
    Junior Member
    Join Date
    Dec 2009
    Posts
    7
    I have attached the files to an email I just sent you. Thanks for your help!

    Nate

  12. #12
    Junior Member
    Join Date
    Dec 2009
    Posts
    7
    I figured it out! I didnt have the .SWC classes installed correctly in flash. It works great now. Thanks so much for all your help Northcode and Flashpipe.

  13. #13
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,764
    I love it when problems solve themselves

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center