A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: mdm zinc 3 Sql Query problem ...

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    3

    Question mdm zinc 3 Sql Query problem ...

    Hi , this code works:
    Code:
    var sqlString5:String = "Delete from pictures where id=2410 "
            mdm.Database[DB].runQuery(sqlString5);

    And this no works:
    Code:
     //.............................//
     //....... sql select code .....//
    
    var iddelete = mdm.Database[DB].getData();
    
    mdm.Dialogs.promopt(iddelete) // This return 2410
    
    var sqlString5:String = "Delete from pictures where id=" + iddelete + " "
            mdm.Database[DB].runQuery(sqlString5);

    Any idea ? please Help Me !

    Thank you

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    A question about Zinc specific functionality is going to require someone from MDM or someone who knows their software pretty well. Have you tried asking MDM? I know they don't usually answer questions in their own forums, but they're even more unlikely to answer them here. I would dump out sqlString5 to make sure it contained what I thought it did. Then I would look at the error code returned from the runQuery() function to see why it failed.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    The SqlString5 is simple name to var, no problem in other querys, My questions is post in mdm forums and send tu "support", but i not recive response, and i need to.

    AHHH MDM ZINC no return me code error !
    only no works !

    Are you member of Northcode Software ok?

    You say me in this post a sample code of connect a MS access database and get data.
    The sample is to fast view and weigh the shift to Swf Studio Software.

    thks
    Last edited by clydde; 03-29-2011 at 04:39 AM.

  4. #4
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Are you member of Northcode Software ok?
    Yes.

    You say me in this post a sample code of connect a MS access database and get data.
    The sample is to fast view and weigh the shift to Swf Studio Software.
    Here's an example of how to query an MS Access database in SWF Studio. I've included the ActionScript code below and attached a working FLA and the sample MDB file it needs.

    The example dumps the results to our trace window in SWF Studio (using ssDebug.trace) but you could do anything you want with the results. The data is returned in XML format but you can get the data in various formats.

    EVERY SWF Studio function returns information that tells you whether the command worked or not. If the command didn't work you get an error code that tells you why so you aren't left stumbling around in the dark.

    Code:
    ssCore.init();
    ssDefaults.synchronousCommands = true;
    
    // Set the connection string for a MS Access database using MS Jet.
    // We need to specify a full path to the datasource. The database exists
    // in the same folder as our application so we can use ssGlobals.ssStartDir.
    
    ssCore.ADO.setConnectString({connectString:"Provider=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False; Data Source="+ssGlobals.ssStartDir+"\\example.mdb;"});
    
    // execute an SQL query 
    
    ssCore.ADO.setSQL({sql:"select * from [2004 Billionaires] where [Name] LIKE 'Wil%'"});
    
    // The values set above are not used until we perform an open command,
    // which will connect to the ADO provider and get a recordset.
    
    var return_obj = ssCore.ADO.open();
    
    if (return_obj.success)
    {
        // if the open completed successfully we get all of the rows from the recordset as XML
        return_obj = ssCore.ADO.getRows();
    
        if (return_obj.success)
        {
            // if there were records to be returned we display them in the SWF Studio Trace tab
            ssDebug.trace(return_obj.result);
        }
        else
        {
            // if an error occurs we display the description in the SWF Studio Trace tab
            ssDebug.trace("ADO.getRows ERROR: "+return_obj.Error.description);
        }
    }
    else
    {
        // if an error occurs we display the description in the SWF Studio Trace tab
        ssDebug.trace("ADO.open ERROR: "+return_obj.Error.description);
    
        // we also display the adoError output parameter for the open method, which will be
        // populated if there is an ADO-specific error message returned from the ADO provider
        ssDebug.trace(" adoError: "+return_obj.adoError);
    }
    The output from ADO.getRows looks like this (below). If you have a lot of data you can also get the data one row at a time instead of all in one call.

    Code:
    <rows>
    <row>
    <field name="Rank" value="1" />
    <field name="Name" value="William Gates III" />
    <field name="Age" value="48" />
    <field name="Worth %28%24bil%29" value="46%2e6" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="Medina%2c WA" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dBH69%26datatype%3dPerson" />
    <field name="Field1" value="1%2f1%2f2009" />
    <field name="ID" value="1" />
    </row>
    <row>
    <field name="Rank" value="132" />
    <field name="Name" value="William Wrigley Jr" />
    <field name="Age" value="40" />
    <field name="Worth %28%24bil%29" value="3%2e6" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="Lake Forest%2c IL" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dBRRF%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="135" />
    </row>
    <row>
    <field name="Rank" value="147" />
    <field name="Name" value="William Cook" />
    <field name="Age" value="72" />
    <field name="Worth %28%24bil%29" value="3%2e2" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="Bloomington%2c IN" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dP9MO%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="150" />
    </row>
    <row>
    <field name="Rank" value="198" />
    <field name="Name" value="Willi %26 Isolde Liebherr %26 family" />
    <field name="Age" value="" />
    <field name="Worth %28%24bil%29" value="2%2e6" />
    <field name="Country Of Citizenship" value="Switzerland" />
    <field name="Country of Residence" value="Switzerland" />
    <field name="City of Residence" value="Bulle" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dSGPI%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="203" />
    </row>
    <row>
    <field name="Rank" value="293" />
    <field name="Name" value="William Davidson" />
    <field name="Age" value="81" />
    <field name="Worth %28%24bil%29" value="1%2e9" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="Bloomfield Hills%2c MI" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dSA0J%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="294" />
    </row>
    <row>
    <field name="Rank" value="437" />
    <field name="Name" value="William Fung" />
    <field name="Age" value="56" />
    <field name="Worth %28%24bil%29" value="1%2e3" />
    <field name="Country Of Citizenship" value="Hong Kong" />
    <field name="Country of Residence" value="Hong Kong" />
    <field name="City of Residence" value="Hong Kong" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dXI3R%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="446" />
    </row>
    <row>
    <field name="Rank" value="437" />
    <field name="Name" value="William Hearst III" />
    <field name="Age" value="54" />
    <field name="Worth %28%24bil%29" value="1%2e3" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="San Francisco%2c CA" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3d206M%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="448" />
    </row>
    <row>
    <field name="Rank" value="437" />
    <field name="Name" value="William Morean" />
    <field name="Age" value="48" />
    <field name="Worth %28%24bil%29" value="1%2e3" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="St%2e Petersburg%2c FL" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3d9LMC%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="459" />
    </row>
    <row>
    <field name="Rank" value="472" />
    <field name="Name" value="William France Jr" />
    <field name="Age" value="71" />
    <field name="Worth %28%24bil%29" value="1%2e2" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="Daytona Beach%2c FL" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dD7U2%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="484" />
    </row>
    <row>
    <field name="Rank" value="514" />
    <field name="Name" value="William Kellogg" />
    <field name="Age" value="60" />
    <field name="Worth %28%24bil%29" value="1%2e1" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="Oconomowoc%2c WI" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dMEAV%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="526" />
    </row>
    <row>
    <field name="Rank" value="552" />
    <field name="Name" value="William Ford Sr" />
    <field name="Age" value="79" />
    <field name="Worth %28%24bil%29" value="1" />
    <field name="Country Of Citizenship" value="United States" />
    <field name="Country of Residence" value="United States" />
    <field name="City of Residence" value="Grosse Pointe Shores%2c MI" />
    <field name="More Info" value="http%3a%2f%2fwww%2eforbes%2ecom%2ffinance%2flists%2f10%2f2004%2fLIR%2ejhtml%3fpassListId%3d10%26passYear%3d2004%26passListType%3dPerson%26uniqueId%3dX5J3%26datatype%3dPerson" />
    <field name="Field1" value="" />
    <field name="ID" value="566" />
    </row>
    </rows>
    Attached Files Attached Files
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    3
    Thankyou very much !

  6. #6
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    No Problem clydde, let me know if you have any problems getting that code to work on your system.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

  7. #7
    Junior Member
    Join Date
    Jun 2011
    Posts
    1
    Hello,

    I see this is old but being a newbie, may I ask for help on this.

    I need to create a login system for a Zinc Desktop App using MySQL Database.
    The Login Form has a Username Field and a Password Field. I want the App to First make sure that the Username entered does exist. If it is not found in the Database, the user must be told that the username entered is not found in the Database and also offer the user an option to register, or just re-enter the username. If the Username was found, then it must be matched with the password. If it doesn't match, the App must tell that the password is incorrect and offer options to re-enter or recover the Password.

    My problem is writing the code in Flash for this function.

    1) How do I write a SELECT statement in Flash AS2 to find the Username in the Database?
    2) After the SELECT statement, how do I get it's results in order to determine whether the Username does or not exist and so inform the User accordingly?

    Please help me with this, I feel so left out

  8. #8
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    My problem is writing the code in Flash for this function.

    1) How do I write a SELECT statement in Flash AS2 to find the Username in the Database?
    2) After the SELECT statement, how do I get it's results in order to determine whether the Username does or not exist and so inform the User accordingly?
    Zinc, and other SWF2EXE applications that do the same job, provide ActionScript libraries that expose the functionality of the SWF2EXE tool.

    In the example above, I've shown the SWF Studio commands you would need to talk to any database that you have an ADO provider for. in this case it was an Access database but there are ADO providers for every major database out there.

    To query a MySQL database using Zinc you'll have to find the Zinc commands that let you access the MySQL database. Then you'll need to find an example that shows you how to perform a query and read the results as well update the database to do what you want.

    My answer to clydde showed how to query an Access database and look at the results. This sample example can be made to work with MySQL by changing just the connection string (assuming the database in MySQL was the same as the Access database). That's the beauty of using ADO for your database access, it's pretty much database agnostic.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

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