Exemple #1
0
        public Form2()
        {
            InitializeComponent();
            database = new ModelContainer();
            var workers = from w in database.workerSet
                          select
                              new
                              {
                                  id = w.Id,
                                  name = w.lname
                              };
            cbox_tabl_name.DataSource = workers.ToArray();//workersToolStripMenuItem
            cbox_tabl_name.DisplayMember = "name";
            cbox_tabl_name.ValueMember = "id";

            var departments = from d in database.departmentSet
                          select
                              new
                              {
                                  id = d.Id,
                                  name = d.dep_name
                              };
            cbox_tabl_name.DataSource = departments.ToArray();
            cbox_tabl_name.DisplayMember = "dept_name";
            cbox_tabl_name.ValueMember = "id";
        }
Exemple #2
0
 public MainForm()
 {
     InitializeComponent();
     try
     {
         database = new ModelContainer();
         MessageBox.Show(database.workerSet.Count().ToString());
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }