本文介绍了使用linq获取表的两列时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在课堂上有这个功能

i have this function in a class

public System.Collections.IList cpv_No_Date_list()
{
    var cpvNoDateList = (from s in context.DB.CPVs
                         select new { s.cpv_no, s.cpv_date} ).ToList();
    return cpvNoDateList;
}





然后我调用此函数并将其作为下拉列表的来源



then i am calling this function and giving it as a source to a drop down list

var Service = IOC.Get<IEntityListService>();
var cpvNoDateSrc = Service.cpv_No_Date_list();

cpvDrpdwn.Items.Add(new ListItem("------------- Select -----------------------------------", "0"));
cpvDrpdwn.DataSource = cpvNoDateSrc;
cpvDrpdwn.DataBind();





函数从表中收集精确数据,但问题是它没有正确显示。

下拉列表中的输出如下:

{cpv_no = 5,cpv_date = 1/2/2013}

{cpv_no = 7,cpv_date = 5 / 2/2013}

{cpv_no = 8,cpv_date = 8/2/2013}



如何摆脱输出中的这些括号???



function is collecting exact data from table but the problem is that it is not presenting it correctly.
Output in dropdown list is like this:
{cpv_no = 5, cpv_date = 1/2/2013}
{cpv_no = 7, cpv_date = 5/2/2013}
{cpv_no = 8, cpv_date = 8/2/2013}

How to get rid of these brackets in output???

推荐答案



这篇关于使用linq获取表的两列时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 02:29
查看更多