コード例 #1
0
ファイル: Nic.cs プロジェクト: suparera/MeltOperation3
 public static NICDBEntities getNicdbContext()
 {
     if (nicdbContext == null)
     {
         nicdbContext = new NICDBEntities();
     }
     return nicdbContext;
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: suparera/MeltOperation3
        private void Form1_Load(object sender, EventArgs e)
        {
            nicdbContext = new NICDBEntities();
            var metalTypeQuery = from m in nicdbContext.MetalTypes
                                 orderby m.id
                                 select m;
            try
            {
                // Bind the ComboBox control to the query,
                // which is executed during data binding.
                // To prevent the query from being executed multiple times during binding,
                // it is recommended to bind controls to the result of the Execute method.

                metalTypeBindingSource.DataSource = ((ObjectQuery)metalTypeQuery).Execute(MergeOption.AppendOnly);
                metalTypePanel1.bindingSource1.DataSource = ((ObjectQuery)metalTypeQuery).Execute(MergeOption.AppendOnly);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            this.reportViewer1.RefreshReport();
        }