2 Replies Latest reply on May 8, 2006 5:28 AM by Graeme Harker

    Best way to update .NET databases with Flex

      So here's the scenario: The current version of the application I'm working on has a Flash 8 front end that updates a SQL Server 2005 database with XML packets through a web service. I am gradually replacing the Flash front end with a Flex developed interface with which I have no trouble displaying the data. Updating the data is another story. The architecture is based on .NET and that is not going to change (if I could then I would), so that is my constraint. I have briefly looked into using Flash remoting but with Flex Data Services 2.0 I want to make sure I'm not missing anything.

      Here's a quick rundown: The current method of updating the database detects changes on the dataset and generates an XML packet based on the generated deltas. This packet gets sent to the web service which is smart enough to know which tables to update.

      What would be best for me would be to get deltas generated in Flex datasets- but I have not seen anything related to this. IS there a similar property of deltas as in the Flash component?

      Ok so now that is out of the way - I would like to take advantage of having Flex update the data source automatically when editing a field. That seems like a great thing.

      How can I do this with Flex? My best guess is to have a Java application server running the Flex WAR application that has a SQL driver that connects to the MS SQL database.


      Brian Cary
      HouseRaising, Inc.
        • 1. Re: Best way to update .NET databases with Flex

          Given your acrhitecture, you would want to run Flex Data Services on a J2EE server (like JBoss or JRun) and have that connect to your SQL server.

          • 2. Re: Best way to update .NET databases with Flex
            Graeme Harker Level 1
            There's no mx:DataSet data type that has all the functionality of .NET's DataSet but mx:ArrayCollection is not far off. In Flex, unlike .NET, all data types support databinding (which is cool). I'm still learning Flex myself but I suspect, if you wanted to avoid having to use FDS on the server, if you were to data bind your mx:DataGrid to a mx:ArrayCollection-based data model you could subscribe to the mx:ArrayCollection's databinding events and synchronize each row change with ADO.NET on the server via a mx:WebService or an mx:HTTPService. Alternatively your event handler could build a collection of the updated rows which you could then synchronize with the server-side DataSet in one go (which you could then do an Update() on to synchronize the changes with the database) .

            Graeme Harker's Flex.NET Blog