小编Bra*_*gue的帖子

如何使用SqlDataSource返回值更新ASP.NET标签

在ASP.NET页面上,我有一个配置了以下SELECT命令的SqlDataSource:

SELECT AVG(Rating) FROM [Ratings] WHERE ([AlbumID] = @AlbumID)

我如何将该平均值放入标签中?

asp.net

2
推荐指数
1
解决办法
7583
查看次数

什么是'@'在ActionScript中做什么?

什么是'@'在ActionScript中做什么?无法在任何地方找到相关信息,主要是因为Google和其他搜索引擎会从搜索查询中删除特殊字符.

actionscript-3

2
推荐指数
1
解决办法
104
查看次数

从LINQ到XML查询获取单个字符串

这是我想要做的:

string parseCode = from x in xml.Descendants("LogType")
                   where x.Attribute("ID").Value == string)ddlHistoryLogDefinitions.SelectedValue
                   select x.Attribute("ParseCode").Value;
Run Code Online (Sandbox Code Playgroud)

但是这会产生错误:"无法将类型'System.Collections.Generic.IEnumerable'隐式转换为'string'"

只有一个值,x.Attribute("ParseCode")但它坚持返回类型IEnumerable<string>.如何将该值提取到字符串中?

编辑:谢谢你的回复.这对我有用:

string parseCode = (from x in xml.Descendants("LogType")
                    where x.Attribute("ID").Value == (string) ddlHistoryLogDefinitions.SelectedValue
                    select (string) x.Attribute("ParseCode").Value).FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)

这个技巧是在.FirstOrDefault()之前将整个linq查询包装在()中.

c# linq linq-to-xml

1
推荐指数
1
解决办法
2316
查看次数

标签 统计

actionscript-3 ×1

asp.net ×1

c# ×1

linq ×1

linq-to-xml ×1