// Constructor
 public MainPage()
 {
     InitializeComponent();
     using (employeeContext context = new employeeContext(employeeContext.dbconstring))
     {
         if (!context.DatabaseExists())
         {
             context.CreateDatabase();
         }
     }
 }
 // define a method known as add employee
 public void addEmployee(string ename, string etitle, string position, string gender, double salary)
 {
     // we shall use the employeecontext connection
     using (employeeContext context = new employeeContext(employeeContext.dbconstring))
     {
         //create a new instance of the class employee
         employee e = new employee();
         //assign fields values
         e.empname  = ename;
         e.title    = etitle;
         e.gender   = gender;
         e.position = position;
         e.salary   = salary;
         //submit for insertion
         context.tblEmployee.InsertOnSubmit(e);
         //save the records
         context.SubmitChanges();
     }
 }