天天看點

PB_删除實作方法

删除方法的一個小分享,當然實作這個功能的方法很多,如果大家那有更優化的方法,請指教!謝謝!

話不多說,代碼走起:

//判斷如果資料行數為0,則直接給出提示資訊
if dw_userinfo_detail.rowcount() = 0 then
	MessageBox('提示','沒有可删除資料')
	return
	
else
	String ls_name
	ls_name = dw_userinfo_detail.Object.username[1]
	
	if MessageBox('提示','是否要删除學生'+ls_name+'的資訊嗎?',Exclamation!,YesNo!) = 1 then
		dw_userinfo_detail.deleterow(1)
	else
		return
	end if
	
	if dw_userinfo_detail.update() = 1 then
		commit;
	else
		MessageBox('提示','删除失敗!')
		rollback;
	end if
	
end if

dw_userinfo_list.retrieve('%')