Save Entity - True/False

Posts   
 
    
Posts: 54
Joined: 22-Jun-2010
# Posted on: 29-Jul-2010 17:03:02   

Hi, I have written the code to save the entity.

private void Savedata() { try { string message; accountnature.Description = ChangeCase.ToTitleCase(tbxdescription.Text.Trim()); accountnature.Createddate = ServerDateTime.getcurrentserverdatewithtime(); accountnature.CreateduserId = StandardMessage.loginuserid;

            var succeeded = adapteraccountnature.SaveEntity(accountnature);

            if (succeeded)
            {
                message = StandardMessage.datasavesuccess;
                adapteraccountnature.CloseConnection();
                DoRefresh();
            }
            else
            {
                message = StandardMessage.datasavefailure;
                adapteraccountnature.CloseConnection();
            }
            MessageBox.Show(message);
        }
        catch (Exception)
        {
            var message = StandardMessage.DataAccessError;
            errorProvider.SetError(tbxdescription, message);
        }
    }

Problem:

I do know what is the problem. After string message I am supposed to add the line adapteraccountnature.FetchEntity(accountnature);. Then it works fine. I have intentionally removed this line to test succeeded true /false

My Question is, why var succeeded = adapteraccountnature.SaveEntity(accountnature); does not return false when it did not save the entity

Even if I write bool succeeded , the result is same. Is this a bug or am I doing something wrong

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 29-Jul-2010 21:51:10   

The following thread gives a pretty good breakdown of the return values from SaveEntity - does this answer your question...?

http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10394&HighLight=1

Matt

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 30-Jul-2010 12:22:55   

MTrinder wrote:

The following thread gives a pretty good breakdown of the return values from SaveEntity - does this answer your question...?

http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10394&HighLight=1

Matt

Got it Thanks