---
# System prepended metadata

title: 基本開發注意事項

---

# 基本開發注意事項
* 視窗放大縮小時元件走位(Anchor設定錯誤)
![](https://i.imgur.com/EVQQJGS.png)

* 按下後會出現資料的按鈕需顯示藍字
![](https://i.imgur.com/LSMW0ts.png)

* 使用DataTable時，若有刪除可能其中的DataRow，請呼叫ExtNotDeletedRows()來排除狀態為Delete的資料行，否則會出現錯誤 "Deleted row information cannot be accessed through the row".
![](https://i.imgur.com/FjAJ7cF.png)

* 在C#轉型可使用MyUtility.Convert方法，傳入值為null也不會導致轉型失敗，會回傳該型態的空值，當為數值則回傳0，當為字串則回傳空字串...等
![](https://i.imgur.com/bbfHV8F.png)
![](https://i.imgur.com/jcO8U6B.png)
![](https://i.imgur.com/cot6DXK.png)

* 在C#寫入、更新SQL時使用參數寫法，避免造成字串截斷(單引號)
![](https://i.imgur.com/L0CxMMU.png)
![](https://i.imgur.com/I1B7qet.png)
![](https://i.imgur.com/nXk0iMh.png)

* SQL別名避免使用a、b、c等流水編碼，建議使用與TableName相關可辨識的縮寫
![](https://i.imgur.com/lE0XEWL.png)

* SQL在多重關聯時，Select時建議使用TableName.Column，否則若關聯表出現相同欄位名稱則會導致"無法繫結多重部分"錯誤
```sql    
select ConsPC
from Orders o
left join Order_BOA boa on o.ID = boa.Id
left join Order_BOF bof on o.ID = bof.Id
where o.Id = 'TEST'
```
此語法會出現Error Ambiguous column name 'ConsPC'.
因為Order_BOA和Order_BOF都有ConsPC欄位，因此寫法需指定boa.ConsPC或bof.ConsPC