Menu

I got TargetInvocationException.

Help
2008-09-24
2013-04-18
  • Diviner Chan

    Diviner Chan - 2008-09-24

    I have tried the example for BindingListView which is downloaded with this project, and work fine. But when I try to make a demo for my owned class, I experience error.

    I have an object class that is DBML created for me. The class is corresponding to a table from database, Employee class. My coding like this:

    BindingList<Employee> empBindingList =
        (BindingList<Employee>)db.Employees.GetNewBindingList();
    BindingListView<Employee> blvEmployee =
        new BindingListView<Employee>(empBindingList);  // Exception here.

    So I try to simplify the code, and try again. The exception error still there:
    BindingList<Employee> empBindingList = new BindingList<Employee>();
    empBindingList.Add(new Employee());
    BindingListView<Employee> blvEmployee =
        new BindingListView<Employee>(empBindingList);  // Exception again.

    If I change the Employee class back to a Item class just like the demo, everythings goes well. So what is the problem of Employee class? The Employee class is created by DBML tool in Visual Studio 2008 with LINQ mechanism.

    Please help. Thank you very much.

    --
    Best regards,
    Diviner.

     
    • Diviner Chan

      Diviner Chan - 2008-09-24

      Does BindingListView support the class generated by DBML?

       
  • John Murray

    John Murray - 2009-10-26

    I am getting the TargetInvocationException as well whenever I try to insert a DBML derived class following a fill of the class usng a linq query.  Has anyone figured out why this results in a TargetInvocationException?

    thank you,

    John

     

Log in to post a comment.

MongoDB Logo MongoDB