2010-02-21 54 views
0

如果我在MySQL中使用常规的不同选择器并在中继器中显示结果,我可以使用以下代码在Webform中显示数据。在网络上显示不同的选择?

<%# DataBinder.Eval(Container.DataItem, "posted") %> 

,但如果我用这个代码:

"SELECT DISTINCT mid(posted,6,1) ORDER BY posted DESC" 

我收到以下错误尝试使用上面的代码。

DataBinding: 'System.Data.Common.DataRecordInternal' does not contain a 
property with the name 'posted'. 

那么如何获取我用“DISTINCT mid”选择器收集的数据以显示在Webform中?

回答

1

做到这一点,using an alias

SELECT DISTINCT mid(posted,6,1) as posted 
FROM Something? 
ORDER BY posted DESC 
+0

奇怪的是,只给我的字符串“System.Byte []” ... 我如何从字段中DATABSE的实际工作价值? – midnightsyntax 2010-06-04 11:30:02

+0

@theSwede:你必须发布你正在运行的代码,我不知道到底发布了什么贴图,还有一层缺失,你可以发布实际运行sql的代码吗? – 2010-06-04 11:42:52