SQL JOIN
-
I am using a dataList and i am joining two tables. Each table is linked by a foreign key of ListedById. But each table has a column in it called ImageId which points to a different image. In SQL I can point at a table.column name like this. tProperties.ImageId and tListedBy.ImageId how can I do this once the data is bound to my datalist control? aka... <%# DataBinder.Eval(Container.DataItem, "tProperties.ImageId")%> aka... <%# DataBinder.Eval(Container.DataItem, "tListedBy.ImageId")%> If anyone could help me it would be really appreciated but I am thinking that it might have to be done before the control is bound. Just it would be nice if this was possible. Thanks, Steve Nelson :((:eek:
-
I am using a dataList and i am joining two tables. Each table is linked by a foreign key of ListedById. But each table has a column in it called ImageId which points to a different image. In SQL I can point at a table.column name like this. tProperties.ImageId and tListedBy.ImageId how can I do this once the data is bound to my datalist control? aka... <%# DataBinder.Eval(Container.DataItem, "tProperties.ImageId")%> aka... <%# DataBinder.Eval(Container.DataItem, "tListedBy.ImageId")%> If anyone could help me it would be really appreciated but I am thinking that it might have to be done before the control is bound. Just it would be nice if this was possible. Thanks, Steve Nelson :((:eek:
First, I do very little databinding, prefer the DIY approach personally :) But my initial impression which may be totally wrong is: In your SQL join statement us the
AS
statement to rename the two fields. e.g.SELECT tProperties.ImageId _AS ImageID1_, tListedBy.ImageId _AS ImageID2_ FROM...
Then in your databinder you can useEval(Container.DataItem, "ImageID1")%
Failing that please tell us the error you are getting as well as posting the SQL join statement. Thanks.Paul Watson
Bluegrass
Cape Town, South AfricaMacbeth muttered: I am in blood / Stepped in so far, that should I wade no more, / Returning were as tedious as go o'er DavidW wrote: You are totally mad. Nice.