我在PB中建立了一個DW,需要連接遠程資料庫的表,當我在DW輸入的某個欄位的值與遠程資料庫表中的某個欄位相等時,把遠程資料庫表中的相關欄位值,賦值到DW中,并保存,請問怎么寫代碼,謝謝
uj5u.com熱心網友回復:
在dw的itemchanged事件中寫代碼:if dwo.name = '用來錄入的列' then
//假設該列為char型別的
string ls, ls_other1, ls_other2, ls_other3
//取得本次錄入的內容
ls = data
//獲取遠程資料庫表中的相關欄位值
select a,b,c into :ls_other1, :ls_other2, :ls_other3 from t where d = :ls using sqlca;
if sqlca.sqlcode = -1 then
messagebox('', '無法檢索相關資料')
return
end if
//相關欄位賦值到dw中
setitem(row, 'other1', ls_other1)
setitem(row, 'other2', ls_other2)
setitem(row, 'other2', ls_other2)
//將dw的內容保存
accepttext()
if update() = 1 then
commit using sqlca;
else
rollback using sqlca;
end if
end if
uj5u.com熱心網友回復:
幫頂頂!!!!uj5u.com熱心網友回復:
http://topic.csdn.net/u/20111013/10/b08e4573-a054-4a09-8ee5-1bb9059e7203.html?65574轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/73435.html
標籤:數據庫相關
下一篇:PB11關閉視窗問題
