首页 新闻 会员 周边 捐助

asp.net

0
悬赏园豆:5 [已解决问题] 解决于 2014-08-11 16:26

显示数据时状态相同的情况下为什么只能显示一条数据?

菜鸟起飞啊的主页 菜鸟起飞啊 | 初学一级 | 园豆:15
提问于:2014-08-11 15:44
< >
分享
最佳答案
0

什么意思?能否详细说明下?

收获园豆:5
田园里的蟋蟀 | 菜鸟二级 |园豆:423 | 2014-08-11 15:45

数据库中有两条数据而显示只有一条

菜鸟起飞啊 | 园豆:15 (初学一级) | 2014-08-11 15:47

@小菜鸟5: 能否把代码贴一下?

田园里的蟋蟀 | 园豆:423 (菜鸟二级) | 2014-08-11 15:48

@田园里的蟋蟀: 

try
{
object[] os = type.GetCustomAttributes(typeof(EnumAttribute), true);
if (os!=null && os.Length > 0)
{
for (int i = 0; i < os.Length; i++)
{
EnumAttribute att = os[i] as EnumAttribute;
if (att.Mode == 1)//按需加载
_enumDatas = EnumsList.Where(item =>
{
try
{
if (att.EnumTypes.Contains(item.Type))
return true;
else
return false;
}
catch { return false; }
}).OrderBy(item => item.Type).ThenBy(item => item.Value).ToList<Dictionary_EnumsManage>();
else if (att.Mode == 2)//全部加载
_enumDatas = EnumsList.OrderBy(item=>item.Type).ThenBy(item=>item.Value).ToList<Dictionary_EnumsManage>();
}
}
}
catch (Exception e)
{
LogHelper.Log_File(string.Format("Messgae:{0} | StackTrace:{1}", e.Message, e.StackTrace),LogLevel.ERROR);
}

string guid = !String.IsNullOrWhiteSpace(context.Request["id"]) ? context.Request["id"] : String.Empty;

DataResult result = new DataResult();
result.DataEntitys = InternalDataSource;
if (!guid.Equals(String.Empty))
{

result.Success = true;
CommunityD_BasicThingsCofig data = CommunityD_BasicThingsCofig.First("select * from CommunityD_BasicThingsCofigs where id=@0", guid);
result.DataEntitys.Add("data", data);
}
else
{
result.Success = false;
result.Message = "错误的信息";
}
return result;

<tr>
<td width="80px" height="20" class="field" >行政区ID</td>
<td height="20" >{$bind name='DivisionId'$}</td>
<td width="80px" height="20" class="field" >年份</td>
<td height="20" >{$bind name='Year'$}</td>
</tr>
<tr>
<td width="80px" height="20" class="field" >总面积
平方公里</td>
<td height="20" >{$bind name='SumArea'$}</td>
<td width="80px" height="20" class="field" >人口密度
人/平方公里</td>
<td height="20" >{$bind name='PopulationDensity'$}</td>
</tr>
<tr>
<td width="80px" height="20" class="field" >总户数</td>
<td height="20" >{$bind name='SumHourseNum'$}</td>
<td width="80px" height="20" class="field" >包括街道数</td>
<td height="20" >{$bind name='StreetNum'$}</td>
</tr>
<tr>
<td width="80px" height="20" class="field" >包括乡镇数</td>
<td height="20" >{$bind name='TownNum'$}</td>
<td width="80px" height="20" class="field" >管理单位ID</td>
<td height="20" >{$bind name='ManageAgencyId'$}</td>
</tr>
<tr>
<td width="80px" height="20" class="field" >管理单位
[:Selector agency,ManageAgencyId]</td>
<td height="20" >{$bind name='ManageAgencyName'$}</td>
<td width="80px" height="20" class="field" >操作员ID</td>
<td height="20" >{$bind name='OperatorId'$}</td>
</tr>
<tr>
<td width="80px" height="20" class="field" >操作员姓名
[:Selector operator,OperatorId]</td>
<td height="20" >{$bind name='OperatorName'$}</td>
<td width="80px" height="20" class="field" >创建时间</td>
<td height="20" >{$bind name='CreateTime' format='{0:yyyy年MM月dd日}'$}</td>
</tr>
<tr>
<td width="80px" height="20" class="field" >最后更新日期</td>
<td height="20" >{$bind name='LastChangedTime' format='{0:yyyy年MM月dd日}'$}</td>
<td width="80px" height="20" class="field" >备注
[:T T]</td>
<td height="20" >{$bind name='Remark'$}</td>
</tr>

菜鸟起飞啊 | 园豆:15 (初学一级) | 2014-08-11 15:54

@小菜鸟5: CommunityD_BasicThingsCofig data = CommunityD_BasicThingsCofig.First("select * from CommunityD_BasicThingsCofigs where id=@0", guid);

田园里的蟋蟀 | 园豆:423 (菜鸟二级) | 2014-08-11 15:58

@田园里的蟋蟀: 不明白

菜鸟起飞啊 | 园豆:15 (初学一级) | 2014-08-11 16:01

@小菜鸟5: 他的意思是你这个方法是 取第一条记录, First

风醉 | 园豆:1197 (小虾三级) | 2014-08-11 16:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册