Guest User

Untitled

a guest
Jun 26th, 2018
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  // Create a new user object.
  2.             user newUser = new user
  3.             {            
  4.                 user_email = "bclau_90@yahoo.com",
  5.                 user_rank = 10,
  6.                 user_password = "password"
  7.             };
  8.  
  9.             // Add the new object to the users collection.
  10.             LearnASPDataContext myDB = new LearnASPDataContext();
  11.             myDB.users.InsertOnSubmit(newUser);
  12.  
  13.             // Submit the change to the database.
  14.             try
  15.             {
  16.                 myDB.SubmitChanges();
  17.             }
  18.             catch (Exception e)
  19.             {
  20.                 return e.Message;
  21.                
  22.                
  23.                 // Make some adjustments.
  24.                 // ...
  25.                 // Try again.
  26.                 //myDB.SubmitChanges();
  27.             }
Add Comment
Please, Sign In to add comment