0 Replies Latest reply on Sep 2, 2008 1:15 PM by EvolvedDSM

    DataService not creating consecutive items

    EvolvedDSM Level 2
      I'm using LCDS with a DataService to connect my Flex web app to ColdFusion data source. I'm able to populate a data grid as well as create a new item to the database via a form on my app, which displays to my data grid. I'm also able to view the realtime data being added from a remote PC, everything looks like it's working great!

      But if I try to add another item after adding my first item, nothing happens. I then have to refresh the app in the browser to add an additional item. Once refreshed, I'm able to add another item, but I have to repeatedly refresh the browser for each additional item.

      Here's the short version of my code: creationComplete = initApp()

      private function initApp():void{
      ds = new DataService("myds");
      ac = new ArrayCollection;
      ds.fill(ac);
      }

      private function createRecord():void{
      var vo:asTable = new asTable();
      vo.col1 = field1.text;
      vo.col2 = field2.text;
      vo.col3 = field3.text;
      ds.createItem(vo);
      }

      And there's a button tied to createRecord()

      As said, the datagrid populates just fine at the start of the app. When I click the button the first time after filling in field1, 2, 3, the datagrid updates with the new item I just added. If I try to add another item, nothing happens. The database doesn't take the additional item I tried to create.

      What am I missing here that is preventing the db from taking additional entries?

      Note: I'm using an SQL database as a CF datasource. This is the first time I've used SQL as a CF datasource. My primary key is a smallint using auto increment, but I assume it works similar to how access does, and I've not run into this particular problem with access.