PB Exercises1
1.0.0
Ventanas abiertas
Open(w_main) // 打開主畫面
Sintaxis de la base de datos
// Profile sun (可至DB Profile 內 copy)
SQLCA.DBMS = "SNC SQL Native Client(OLE DB)"
SQLCA.LogPass = "123456"
SQLCA.ServerName = "sun-pcsqlexpress"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = "Database='sun_test',Provider='SQLNCLI10'"
//Conncet
CONNECT USING SQLCA; //開始連接SQLCA
//訊息碼判斷 0 => 執行成功。 | 100 => 成功但無資料。 | <0 => 有錯誤。
if SQLCA.SQLCode = 0 then
MessageBox("","Connect sucessful !") //成功
else
MessageBox("","Connect error !") //有錯誤
end if

//Connect Button Clicked Event
dw_1.settransobject(SQLCA)
//Retrieve Button Clicked Event
dw_1.retrieve()
//Insertrow Button Clicked Event
dw_1.insertrow(0) // 參數為0,代表在當前Datawindow的最後一行插入一空行
//Update Button Clicked Event
dw_1.update()
if dw_1.update() = 1 then
Commit USING SQLCA;
else
ROLLBACK USING SQLCA;
end if