C# – Problem with linq to sql insert

clinq-to-sql

My linq to sql insert class don't give a error and don't insert and i can't find out why.
When i test the code in LinqPad i did work.

        public void CreateRole(string Role)
    {

        Roles role = new Roles()
        {
            Title = Role,
        };


        data.Roles.InsertOnSubmit(role);

        try
        {
            data.SubmitChanges();
        }

        catch (Exception ex)
        {
            throw ex;
        }
    }

This is the class i have to insert my data. 'data' is get of my dbml file.

CreateRole("Users"); don't work.

I don't get any error and it don't insert. I can get data out of the database but not insert in any table.

Best Answer

I figure it out, the problem where that "data" is just get and not set.