功能
string hzcol
//sWhere 現為實例變量
string sOper
long left_kh
integer i
dwItemStatus l_status
if ib_changed = true then
ib_changed = false
else
return
end if
rownum = dw_where
//去掉dw_where中MaxEditRow行以前所有中間為空或
//者輸入不完整的行
i =
delnum =
DO WHILE i <= MaxEditRow
l_status = dw_where
if l_status <> New! then
hzcol = GetItemString(i
sValue = GetItemString(i
if (hzcol =
dw_where
delnum +=
MaxEditRow +=
Continue
end if
else
dw_where
delnum +=
MaxEditRow +=
Continue
end if
i +=
LOOP
For i =
dw_where
Next
//檢查左右括號是否匹配
For i =
l_status = dw_where
if l_status <> New! then
left_kh += inv_string
right_kh += inv_string
end if
Next
i = left_kh
if i <>
if i >
sValue =
else
sValue =
end if
if MessageBox(
return
else
dw_where
return
end if
end if
//形成WHERE子句
sWhere =
For i =
hzcol = GetItemString(i
sOper = space(
// 去掉空格鍵
sValue = Trim(GetItemString(i
sLeft_kh = GetItemString(i
if isNull(sLeft_kh) then sLeft_kh =
if Pos(sValue
sRight_kh = Right(sValue
else
sRight_kh =
end if
sValue = inv_string
sValue = inv_string
sValue = inv_string
sLog = GetItemString(i
if sLog =
sLog =
dw_where
end if
ywcol = wf_getYwName(hzcol) //表名
sType = lower(wf_getYwType(hzcol))
CHOOSE CASE sType
CASE
if trim(sOper) =
sWhere +=
else
sWhere +=
end if
CASE
if trim(sOper) =
if MessageBox(
return
else
dw_where
return
end if
end if
if isNumber(sValue) then
sWhere +=
else
if MessageBox(
Return
else
dw_where
return
end if
end if
CASE
if trim(sOper) =
if MessageBox(
return
else
dw_where
return
end if
end if
if sType =
if not isdate(sValue) then
if MessageBox(
Return
else
dw_where
return
end if
end if
sValue = wf_dateconvert(sValue)
sWhere +=
else
//datetime型的字段在sybase中轉換為字符串的類型
sValue = wf_datetime(sValue)
if sValue =
if MessageBox(
Return
else
dw_where
return
end if
end if
sWhere +=
sLog
end if
CASE ELSE
beep(
MessageBox(
Return
END CHOOSE
Next
//去掉最後一個邏輯符
Long pok
pp =
DO WHILE True
pok = pp
pp = Pos(sWhere
if pp =
LOOP
if pok >
return
//最後一個邏輯符去掉結束
//至此
功能
string s_object
s_object = This
if left(s_object
MainWindow
else
MainWindow
end if
功能
// 如果數據窗口dw_result上並無ue_action_refresh事件
// 則用戶必須重載本事件
// 如:
// dw_result
//
// 或者如果數據窗口dw_result有retrieve參數
// 則用戶也必須重載本事件
// 如:
// string ls_id
// ls_id =
// dw_result
dw_result
From:http://tw.wingwit.com/Article/program/SQL/201311/16218.html