在PB中如何实现数据模糊查询

豆豆网   技术应用频道   2006年08月05日    社区交流

本文详细介绍在PB中如何实现数据模糊查询

  X = 46 Y = 120 Width = 2459 Height = 448
TabOrder = 40 Visible = true Enabled = true DataObject = "d_where"
VScrollBar = true Border = true BorderStyle = stylelowered!

  9.1 DataWindow: dw_where的 editchanged 事件:

  功能:设置"执行"按钮是否有效。

  9.2 DataWindow: dw_where的itemchanged 事件:

  功能:见代码中的注释。

  string colname,colvalue, logvalue
long currow
ib_changed = true
cb_exec.Enabled = True
currow = GetRow()
If MaxEditRow < Currow Then MaxEditRow = currow
// MaxEditRow 为当前已编辑过的最大行的行号。实例变量。
colname = GetColumnName()
colvalue = GetItemString(currow,colname)
Choose Case dwo.name
Case 'dispvalue'
Object.value[row] = data
Case Else
End Choose
//设置当前行的operator的初始值为"="
//设置上一行的logical的初始值为"and"
if colname = "column1" then
if colvalue = "" or isnull(colvalue) then
SetItem(currow,"operator","=")
if currow >= 2 then
colvalue = GetItemString(currow - 1,colname)
logvalue = GetItemString(currow - 1,"logical")
if colvalue <> "" and (logvalue = "" or isnull(logvalue)) then
SetItem(currow - 1,"logical","and")
end if
end if
end if
end if
//检查并设置左括号。
long ll, i
colvalue = GetText()
if colname = "precol" then
if colvalue <> "" and not isnull(colvalue) then
ll = len(colvalue)
colvalue = ""
For i = 1 to ll
colvalue += "("
Next
SetItem(currow,"precol",colvalue)
this.Settext(colvalue)
Return 2
end if
end if

作者:张爱生    责编:豆豆技术应用

正在加载评论...