我正在開發使用基於Joomla的數據庫的CMS!在的Joomla分貝,我們有2個表:在包含相同字段名的兩個表上選擇?
+----------+
|Categories|
+----------+
id
title
...
+-------+
|Content|
+-------+
id
title
catid
...
我有下面的查詢:
SqlQuery q = new Select("*")
//.Top("1")
.From(JosContent.Schema)
.InnerJoin(JosUser.IdColumn, JosContent.CreatedByColumn)
.InnerJoin(JosCategory.IdColumn, JosContent.CatidColumn)
.Where("catid").IsEqualTo(catId);
而在ASPX頁面,我展示的數據這樣的:
Tite : <%# DataBinder.Eval(Container.DataItem, "title") %>
In category : <%# DataBinder.Eval(Container.DataItem, "title") %>
// Category tite not Content title, but ASP.NET think it is Content title :-(
請幫助我修復它?如何在這之間進行分離?
非常感謝!
不要使用select *,不好的做法。 – grepsedawk 2009-05-23 16:10:34