1 Reply Latest reply on Feb 24, 2011 10:02 AM by Pablo Souza

    HTTPService : insert data in the DataBase

    lazurens2011

      Hello guys,

      My problem is that everything looks great and correct in my code, but when I run I don't have what I need.

      I am about creating a form entry to collect the datas from user and store it the User table that is it.

      and I used an HTTPService to do that please can guess why it is not working when I click on the button "insert user"

      here is the code :

       

      package events
      {
           import ValueObject.UserVO;
           import flash.events.Event;
           public class UserEvent extends Event
           {
                public var user:UserVO;
                public function UserEvent(type:String)
                {
                     super(type);
                }
      
           }
      }
      __________Action script class to create an object User from the data sent on the contructor from the Input form : 
      
      
      package ValueObject
      {
           public class UserVO
           {
                public var login : String;
                public var password : String;
                public var email : String;
                public var firstName : String;
                public var lastName : String;
                public function UserVO(
                     login:String, password:String, email:String,
                     firstName:String, lastName:String)
                {
                     this.login = login;
                     this.password = password; 
                     this.email = email;
                     this.firstName = firstName;
                     this.lastName = lastName;
                }
      
           }
      }
      ____________Collect all the datas in one Object "param" and sens it with the HTTPService : 
      
      
      
      private function insertHandler(event:UserEvent):void                 {                     var param:Object = new Object();                                          param.method = "Insert";                      param.UserLogin = event.user.login;                      param.UserPassword = event.user.password;                     param.UserEmail = event.user.email;                     param.UserFirstname = event.user.firstName;                     param.UserLastname = event.user.lastName;                                          myFormService.send(param);                                                              Alert.show("A new user was inserted","Insert user");                }
      
      

       

       

       

      Conclusion :  When I execute the code, the Alert show on the screen when click on the button that dispatches the event, which means that the Service "myFormService" was executed ! but when I check the database I don't see a new raw on the User table ! I hope that I succeeded to describe you the case ! please if you need any other detail, just ask for it and I'll reply I wish that someone will help me with this form Entry. see you,