Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Boolean insertDefaultUser()
- {
- Boolean flag = true;
- Users newUser = new Users();
- newUser.alias = "bulby";
- newUser.password = "chicken";
- newUser.email = "r@hot.com";
- dbc.Users.AddObject(newUser); // ERROR !
- dbc.SaveChanges();
- return flag;
- }
- Error "The best overloaded method match for System.Data.Objects.ObjectSet<Guild_Chat.User>.AddObject(Guild_Chat.User)' has some invalid arguments ".
- public bool InsertDefaultUser()
- {
- try
- {
- Guild_Chat.User newUser = new Guild_Chat.User
- {
- alias = "bulby",
- password = "chicken",
- email = "r@hot.com"
- };
- dbc.Users.AddObject(newUser);
- dbc.SaveChanges();
- return true;
- }
- catch(Exception e)
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement