The type of one of the primary key values did not match the type defined in the entity. See inner exception for details

后端 未结 4 1271
轻奢々
轻奢々 2021-01-12 09:41

I have the followng method:-

public ActionResult CustomersDetails(string[] SelectRight)
{
    var selectedCustomers = new SelectedCustomers
    {
        Inf         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 10:01

    I know this is an old post but I figured I'd add a comment here since I had the same problem.

    All I did was re-arrange the parameters in the find function.

    I had it like this:

    public ActionResult Details(Int32 id, string dataSource)
            {
                TVData_VW_ShowList tvdata_vw_showlist = context.TVData_VW_ShowList.Find(id, datasource);
                if (tvdata_vw_showlist == null)
                {
                    return HttpNotFound();
                }
                return View(tvdata_vw_showlist);
            }
    

    And I had to change it to this:

    public ActionResult Details(Int32 id, string dataSource)
            {
                TVData_VW_ShowList tvdata_vw_showlist = context.TVData_VW_ShowList.Find(dataSource, id);
                if (tvdata_vw_showlist == null)
                {
                    return HttpNotFound();
                }
                return View(tvdata_vw_showlist);
            }
    

提交回复
热议问题