彈出提示窗口時,點擊了'取消'按鈕? ? ? if MessageBox("提示","是否修改船期日期?",question!,yesno!) = 2 then return
datawindow中設置可以輸入 ?? ? d_row=dw_1.insertrow(0)???? dw_1.scrolltorow(d_row)
船期確認中'保存'事件
if idw_1.update() = 1 then?
if g_co_no = '002' then
string ls_sql
ls_sql = "sp_invoice_update_unite '" + ls_inv_no + "'"
execute immediate :ls_sql;
if sqlca.sqlcode <> 0 then
rollback;
messagebox("提示", "更新分票錯誤!")
return
end if
end if
commit using sqlca;
if uf_sd001_send_to_sap(ls_inv_no,4) = 0 then
messagebox("提示","修改成功!")
end if
closewithreturn(parent ,'1')
else
ls_sqlerrtext = sqlca.sqlerrtext
rollback using sqlca;
messagebox("提示","保存失敗:"+ls_sqlerrtext)
end if
PB中的緩沖區? ? 例如? dw_1.SetItemStatus(d_row, 0,? Primary!, NotModified!)
UpperBound (Obtains the upper bound of a dimension of an array.)
pos (Finds one string within another string.)返回的是一個long類型,? Pos(string1,string2{,start} )? 返回string1中從start開始查詢的包含string2的位置,位置是從start開始查的,但是是實際的位置數.例如:ll_num = pos("abdcdefga","a",5) ll_num得到的是9
mid (Obtains a specified number of characters from a specified position in a string)返回的是一個string類型.? Mid(string,start{,length} ),返回從star開始至字符串最后一個
len(string) 獲取一個字符串的長度,返回的是一個long類型(在PB9.0中的漢字長度為2 len('你') = 2 但是 在PB12.0中漢字長度為1 len('你') = 1)
Left(string,n)返回的是一個string類型字符串,是從第一個字符開始返回n個字符
Right(string,n)返回的是一個string類型字符串,是從最后一個字符開始往前計算返回n個字符
Mod(x,y)得到x/y的余數
Round(x,n)把x置為含有n個小數位的decimal數值,例如:Round(9.624, 2)? 返回的是9.62
IsNumber(string)返回一個Boolean類型數據,如果string是一個數值的,則是true,否則是false
致富文本框為空
string ls_null
setnull(ls_null)
mle_1.text=ls_null
致datawindow為空 dw_1.retrieve("Nothing")
實例一個UpDate()函數:
rc = dw_1.update()
if rc > 0 then
commit using sqlca;
if sqlca.sqlcode<0 then
messagebox("數據庫出錯","錯誤號="+string(sqlca.sqldbcode) + "原因為:" + sqlca.sqlerrtext)
halt close
end if
else
rollback using sqlca;
if sqlca.SQLCode < 0 then
messagebox("數據庫出錯","錯誤號=" + string(sqlca.SQLdbcode) + "原因為:" + sqlca.sqlerrtext)
halt close
end if
end if
continue的用法
integer A=0, B=0, Count
FOR Count = 1 to 100
A = A + 1
IF Count > 15 THEN CONTINUE
B = B + 1
NEXT
// Upon completion, a=100 and b=15.
DaysAfter(date1,date2)函數的用法:
This statement returns 4:
DaysAfter(2002-12-20, 2002-12-24)
This statement returns -4:
DaysAfter(2002-12-24, 2002-12-20)
This statement returns 0:
DaysAfter(2003-12-24, 2003-12-24)
This statement returns 5:
DaysAfter(2003-12-29, 2004-01-03)
Move(x,y)函數的使用方法:
objectname.Move(x,y) 相對于父類,把位置移動到了(x,y)處 .? 例如:gb_box1.Move(150,200)
拼接paint_no的最小值,'_'和最大值的第五個字母之后的數據作為查詢路徑
string ls_path
choose case dwo.name
case 'b_open'
if DaysAfter(2017-05-17,date(getitemdatetime(getrow(),'pac_date')))<0 or isnull(getitemdatetime(getrow(),'pac_date')) then
ls_path = "\\s20\Bestway\Packaging(包裝)\Final Packaging Assets(最終印刷品資料)\JPG\Customization(客專JPG)\不干膠\"+getitemstring(getrow(), 'guidang_no')
else
if dw_2.rowcount() = 1 then
ls_path = "\\S20\bz\生產交接資料\不干膠和貼簽\"+getitemstring(getrow(), 'paint_no')
end if
if dw_2.rowcount()>1 then
ls_path = "\\S20\bz\生產交接資料\不干膠和貼簽\"+getitemstring(getrow(),'compute_min')+'_'+mid(getitemstring(getrow(),'compute_max'),5)
end if
end if
// ls_path = "\\s20\Bestway\Packaging(包裝)\Final Packaging Assets(最終印刷品資料)\JPG\Customization(客專JPG)\不干膠\"+getitemstring(getrow(), 'guidang_no')
// ls_path = "\\s20\BZ\客戶包裝JPG\不干膠\"+getitemstring(getrow(), 'guidang_no')
//? ? ? ls_path = "\\s20\BZ\不干膠匯總(Stickers Collection)\" + mid(getitemstring(getrow(), 'guidang_no'), 7,4) + "年不干膠\" +getitemstring(getrow(), 'guidang_no')
if fileexists(ls_path) = false then
messagebox("提示", "文件夾[" + getitemstring(getrow(), 'guidang_no') + "]不存在")
return
else
run("explorer " + ls_path + "\")
end if
end choose
isvalid的使用方法:
if not isvalid(message.powerobjectparm) then
messagebox("提示", "無效對象調用!")
close(this)
return
typeof的使用方法:(多使用于控件類型之中)
if typeof(message.powerobjectparm) <> DataWindow! then
messagebox("提示", "調用的對象不是DataWindow!")
close(this)
return
end if
end if
classname的使用方法: (多使用于變量之中)
string stringval
double dblval
date dateval
any anyval
anyval = myoleobject.application.cells[1,1].value
CHOOSE CASE ClassName(anyval)
CASE "string"
stringval = anyval
CASE "double"
dblval = anyval
CASE "datetime"
dateval = Date(anyval)
END CHOOSE
getactivesheet()的使用方法
mdiframewindow.GetActiveSheet( ) 返回的是一個MDI!類型的窗口.
Move的使用方法:(移動其坐標位置)
This statement changes the X and Y properties ofgb_box1to 150 and 200, respectively, and movesgb_box1to the new location:
gb_box1.Move(150, 200)
This statement moves the picturep_Train2next to the picturep_Train1:
P_Train2.Move(P_Train1.X + P_Train1.Width, &
P_Train1.Y)
//ldt_sap_check_date = today()//此時間為電腦上的時間
//invoice1.sap_check_date = getdate()//此時間為系統上的時間
exit退出循環
return退出程序
setpointer的使用方法
int i
pointer oldpointer
if dw_1.rowcount() <= 0 then return
oldpointer = SetPointer(HourGlass!)
if this.checked then
for i = 1 to dw_1.rowcount()
dw_1.setitem(i,'ck','1')
next
else
for i = 1 to dw_1.rowcount()
dw_1.setitem(i,'ck','0')
next
end if
setpointer(oldpointer)
//以下代碼把焦點定位到第5行第3個字段:
dw_1.setfocus()//焦點切換到數據庫窗口
dw_1.setrow(5)//切換當前行為第5行
dw_1.selectrow(0,false)//取消高亮顯示
dw_1.selectrow(5,true)//高亮顯示第5行
dw_1.setcolumn(3)//焦點移動到第3個字段
move(x,y)此函數修改的是控件的x,y坐標
resize(width,height)此函數修改的是控件的寬與高
????????????????????????????????????????????????? match函數
SQL中的創建觸發器--觸發器例子
int value
value = GetFileSaveName("選擇文件存放位置", "c:\", w_reg_main.inv_no+".XLS", "XLS", "Excel文件 (*.XLS),*.XLS")
if value<>1 then
?? return 0
end if
lds_detail.saveas(ls_path, excel!, true)
模板導出
string ls_path, ls_file
int li_rc
ls_path = '快遞導入模板'
li_rc = GetFileSaveName ( "Select File", ls_path, ls_file, "XLS", "Excel (*.xls),*.xls" , "C:\", 32770)
IF li_rc <> 1 Then return
integer li_FileNum
li_FileNum = FileCopy ("\\s03\共享文件\W.信息中心\個人文件夾\王灼安\BW_Express9快遞\Bmp\快遞導入模板.XLS" , ls_path, false)
if li_FileNum = -1 then
messagebox("提示", "復制文件錯誤!")
return
end if
Find
ls_key_id = dw_5.getitemstring(getrow(), 'key_id')
ll_row = dw_3.find("key_id='"+ls_key_id+"'", 1, dw_3.rowcount())
富文本框中去掉回車~n
string ls_mle_1, ls_string_before
integer li_pos
ls_mle_1 = trim(mle_1.text)
li_pos = pos(ls_mle_1, '~n')
do while li_pos > 0
ls_string_before = mid(ls_mle_1, li_pos + 1)
ls_mle_1 = trim(ls_string_before)
SetNull(li_pos)
li_pos = Pos(ls_mle_1, '~n')
loop
if isnull(trim(ls_mle_1)) or trim(ls_mle_1) = '' then
MessageBox('提示', '您輸入的內容為空')
return
end if
Send(handle,message#,lowword,long)
錯誤:
解答:這種錯誤查看下文件夾中是否包含代碼中所描述的文件夾
dddw:可指 edit中的 DropDownDW 類型下的DataWindow? ? ?? 例如 ? ? ? dw_1.modify("mer_no.dddw.allowedit=no")