tags:

views:

18

answers:

1

If I use a regular distinct selector with MySQL and show the results in a repeater I can show the the data in the webform with the following code.

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

But If I use this code:

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

I get the following error trying to use the code above.

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

So how do I get the data I've collected with the "DISTINCT mid"-selector to appear in the webform?

+1  A: 

Do this, using an alias:

SELECT DISTINCT mid(posted,6,1) as posted 
FROM Something?
ORDER BY posted DESC
Nick Craver
Strange that only gives me the string "System.Byte[]"...How do I get the actuall value from the field in the databse?
theSwede
@theSwede: You'd have to post the code you're running, I don't know what "posted" maps to exactly, there's a layer missing, can you post the code actually running the sql?
Nick Craver