如何使用SQL AS generic_name读取条目文本

时间:2012-04-03 17:58:08

标签: sql repeater

如何使用SQL“Resim”读取条目文本

嗨,我不知道阅读表格中的条目文本。 (我想用asp:Repeater)

得到错误:

  

DataBinding:'System.Data.DataRowView'不包含名为'Resim'的属性。

我的中继器

        <asp:Repeater id="MyRepeater" runat="server">

            <ItemTemplate>  

            <%# DataBinder.Eval(Container.DataItem, "Model")%>  
            <%# DataBinder.Eval(Container.DataItem, "car_pay_day")%>
            <%# DataBinder.Eval(Container.DataItem, "Resim")%>
            <%# DataBinder.Eval(Container.DataItem, "Galeri")%>

            </ItemTemplate>

        </asp:Repeater>

我的SQL查询

SELECT  
Car.*, 
car_image_url AS Resim,
user_agent_name AS Galeri,
cma_name AS Marka ,
cmo_name AS Model,
cs_name AS Seri,
city_name AS Sehir

FROM    RentACar.dbo.Car

INNER JOIN RentACar.dbo.Users
ON car_user_id = user_id

INNER JOIN RentACar.dbo.Cat_Mark
ON car_cma_id = cma_id

INNER JOIN RentACar.dbo.Cat_Model
ON car_cmo_id = cmo_id

INNER JOIN RentACar.dbo.Cat_Series
ON car_cs_id = cs_id    

INNER JOIN RentACar.dbo.City
ON car_city_id = city_id            



LEFT JOIN
(   SELECT  Img.*
FROM    RentACar.dbo.Car_Image Img
INNER JOIN 
(   SELECT  MIN(car_image_id) AS Image_ID
FROM    RentACar.dbo.Car_Image
GROUP BY car_image_car_id
) AS MaxImg
ON MaxImg.Image_ID = Img.car_image_id
) AS Img
ON Img.car_image_car_id = car_id;

1 个答案:

答案 0 :(得分:0)

我使用<%# DataBinder.Eval(Container.DataItem, "Foto")%>并且有效。