本示例是乙個關係sl 3 三張表資料的顯示問題,執行結果如下所示:
表關係如下圖所示:
這些資料的顯示都是通過呼叫後台服務wcf,支援資料顯示;
後台服務**如下所示:
[servicecontract(namespace = "對外提供資料服務")][aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequirementsmode.allowed)]
public class
dataservices
[operationcontract]
public
list
getcustomerbyid(string customerid)
[operationcontract]
public
list
getorders(string customerid)
[operationcontract]
public
list
getorderdetails(int orderid)
}
dataserviceclient.dataservicesclient svc = new dataserviceclient.dataservicesclient();public mainpage()
private void lstcustomers_loaded(object sender, routedeventargs e)
void svc_getcustomerallcompleted(object sender, getcustomerallcompletedeventargs e)
else
}private void lstcustomers_selectionchanged(object sender, selectionchangedeventargs e)
else
};svc.getordersasync(selectedcustomer.customerid);}}
private void dgorders_selectionchanged(object sender, eventargs e)
else
};svc.getorderdetailsasync(selectedorder.orderid);}}
private void dgorderdetails_autogeneratingcolumn(object sender,
datagridautogeneratingcolumneventargs e)
ui 頁面**如下所示:
<grid x:
name
="layoutroot"
background
="white">
<
grid.rowdefinitions
>
<
rowdefinition
height
="55" x:
name
="headerrow" />
<
rowdefinition
height
="*" x:
name
="contentrow"/>
<
rowdefinition
height
="20" x:
name
="footerrow"/>
grid.rowdefinitions
>
<
grid.columndefinitions
>
<
columndefinition
width
="*" />
grid.columndefinitions
>
<
textblock x:
name
="txtheader"
grid.row
="0"
fontsize
="20"
margin
="5,5"
foreground
="blue"
text
textblock
>
<
textblock x:
name
="txtstatus"
grid.row
="2"
fontsize
="10"
margin
="5,0"
foreground
="red">
textblock
>
<
grid x:
name
="contentgrid"
grid.row
="1"
margin
="5">
<
grid.rowdefinitions
>
<
rowdefinition
height
=".6*" />
<
rowdefinition
height
=".4*" />
grid.rowdefinitions
>
<
grid.columndefinitions
>
<
columndefinition
width
="200" />
<
columndefinition
width
="*" />
grid.columndefinitions
>
<
listbox x:
name
="lstcustomers"
grid.column
="0"
grid.rowspan
="2"
displaymemberpath
="contactname"
loaded
="lstcustomers_loaded"
selectionchanged
="lstcustomers_selectionchanged">
listbox
>
<
data
:datagrid x:
name
="dgorders"
grid.row
="0"
grid.column
="1"
autogeneratecolumns
="true"
selectionchanged
="dgorders_selectionchanged">
data
:datagrid
>
<
data
:datagrid x:
name
="dgorderdetails"
grid.row
="1"
grid.column
="1"
autogeneratecolumns
="true"
autogeneratingcolumn
="dgorderdetails_autogeneratingcolumn">
data
:datagrid
>
grid
>
grid
>
多表關聯解決資料在MVC顯示
由於子表的某些欄位是父表的外來鍵,正常情況之下,顯示的只是乙個鍵值。如下圖的highlight列,如果這樣顯示,確實不友好。如果是在建立或是編輯的模式之下,我們可以使用下拉列表來解決,如 html.dropdownlistfor練習 2 但在顯示時,我們可以寫乙個函式,來實現乙個友好名稱顯示,但是這...
資料程式設計 3 oracle 多表查詢
單行函式 返回單行結果 1.字元函式 1.1大小寫控制函式 lower upper initcap 將單詞首字母大寫,其他字元小寫 1.2字元控制函式 concat 字元連線 只能有兩個引數 拼接多個是 可以巢狀呼叫 substr str,0,5 下標開始位 既可以是0也可以是1 這個是當初開發的乙...
使用OPENLAYERS 3 顯示聚合資料
使用openlayers 3 地圖元件比較容易解決這個問題,關鍵是 ol.source.cluster 物件,這個物件有兩個引數,乙個是聚合距離,乙個是原始的點資料。片段如下 1 初始化ol3 map物件 this.ol2d new ol.map view new ol.view 2 準備json資...