EntityFramework dll中发生System.Data.Entity.Core.MetadataException类型的未处理异常

时间:2017-02-15 20:06:32

标签: c# visual-studio visual-studio-2015

Error Which i am facing , 我不知道突然发生了什么,一切都很好,现在它给了我这个错误! EntityFramework.dll中出现未处理的“System.Data.Entity.Core.MetadataException”类型异常

其他信息:无法加载指定的元数据资源。

private void button1_Click(object sender, EventArgs e)
{
    EMSEntities dbobj = new EMSEntities();
    int employeesearch = Convert.ToInt32(textBox11.Text);

    int a = 0;

    var result = dbobj.sp_Employee_search(employeesearch).ToList();

    foreach (var r in result)
    {
        textBox1.Text = r.Emp_Name;
        textBox2.Text = Convert.ToString(r.E_ID);
        textBox3.Text = r.City;
        textBox4.Text = r.Address;
        textBox5.Text = r.Gender;
        textBox6.Text = Convert.ToString(r.Salary);
        textBox7.Text = Convert.ToString(r.D_ID);
        textBox8.Text = Convert.ToString(r.DG_ID);
        textBox9.Text = r.CNIC;
        textBox10.Text = r.Contact;
        textBox13.Text = Convert.ToString(r.DOJ);
        textBox12.Text = r.Age; 

        label11.Text = r.E_ID.ToString();
        a = r.E_ID;
    }
    if (a != 0)
    {
        MessageBox.Show("Employee Found");
    }
    else
    {
        MessageBox.Show("Please Enter Valid ID!");
    }
}

0 个答案:

没有答案