MasteringVFP/3/3

出自VFP Wiki

跳轉到: 導航, 搜尋

Table

一般翻譯為資料表格,是很基礎的一樣物件~基本上把它想像為 excel 有很多的格子可以放資料,這樣子或許會比較容易了解.所以資料表格是一個只有行與列的世界,一個無限延伸的二維世界.

在 VFP 裡面我們可以透過 Database Designer 或是直接在指令視窗裡輸入 create table 來建立一個新的資料表格.

以 Database Designer 建立 Table 的步驟大致如下: 1.首先打開 Database Designer http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-01.jpg

2.以滑鼠雙擊空白的地方,此時會出現一個快捷功能表,選擇 New Table http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-02.jpg

3.接著會詢問你要使用精靈來新增或自行設定.使用精靈的話,VFP提供了許多範例可以直接套用,最後還可以讓你自行修改.這裡我們選擇自行設定,事實上一般也是使用自行設定比較多. http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-03.jpg

4.詢問要將此 Table 存放於何處.初學者常常會東放一個西放一個,這樣在發布的時候會有困擾,建議將所有同一資料庫的所有 Table, Index...等等都放到同一個目錄下. http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-04.jpg

5.建立你所需的欄位. http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-05.jpg

6.也可以設定索引. http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-06.jpg

7.還可以設定一些 trigger, record validation以及註解. http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-07.jpg

8.大功告成,VFP最後會詢問你要不要順便輸入資料. http://wiki.sunyear.com.tw/fileupload/store/dd-newtable-08.jpg