数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

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


发布日期:2023年10月15日
 
在PB中如何实现数据模糊查询(四)
StaticText: st_属性

X = Y = Width = Height =

TabOrder = Visible = true Text = 请输入查询条件: TextColor =

BackColor = Alignment = left! FillPattern = solid!

CommandButton: cb_exit属性

X = Y = Width = Height =

TabOrder = Visible = true Enabled = true Text = &F返回

Cancel = true

CommandButton: cb_exit的 clicked 事件

功能直接退出

Close(parent)

CommandButton: cb_exec属性

X = Y = Width = Height =

TabOrder = Visible = true Enabled = true Text = &Z执行

Default = true

CommandButton: cb_exec的 clicked 事件

功能设置组和sql语法

注释n_cst_sqln_cst_sqlattrib为PFC中用户对象这里不再详述

DataWindow: dw_column属性

X = Y = Width = Height =

TabOrder = Visible = true Enabled = true DataObject = d_column_set

Border = true LiveScroll = true BorderStyle = stylebox

DataWindow: dw_where属性

X = Y = Width = Height =

TabOrder = Visible = true Enabled = true DataObject = d_where

VScrollBar = true Border = true BorderStyle = stylelowered!

DataWindow: dw_where的 editchanged 事件

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

DataWindow: dw_where的itemchanged 事件

功能见代码中的注释

string colnamecolvalue logvalue

long currow

ib_changed = true

cb_execEnabled = True

currow = GetRow()

If MaxEditRow < Currow Then MaxEditRow = currow

// MaxEditRow 为当前已编辑过的最大行的行号实例变量

colname = GetColumnName()

colvalue = GetItemString(currowcolname)

Choose Case dwoname

Case dispvalue

Objectvalue[row] = data

Case Else

End Choose

//设置当前行的operator的初始值为=

//设置上一行的logical的初始值为and

if colname = column then

if colvalue = or isnull(colvalue) then

SetItem(currowoperator=)

if currow >= then

colvalue = GetItemString(currow colname)

logvalue = GetItemString(currow logical)

if colvalue <> and (logvalue = or isnull(logvalue)) then

SetItem(currow logicaland)

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 = to ll

colvalue += (

Next

SetItem(currowprecolcolvalue)

thisSettext(colvalue)

Return

end if

end if

DataWindow: dw_where的losefocus 事件

AcceptText()

DataWindow: dw_where的rbuttondown 事件

功能设置弹出式菜单

注释

) m_cpq_rbutton_paste菜单的属性和代码如下

MenuItem = m_ a

Visible = true Enabled = true

MenuItems for m_

MenuItem = m_value &V取现有值

Visible = true Enabled = true

Script for: nt clicked event

long ll_pos

String sSyntaxls_parmls_datals_disp

datawindow dwp

dwp = MessagePowerObjectParm

sSyntax = MessageStringParm

if sSyntax = or isNull(sSyntax) then

beep()

return

end if

OpenWithParm(w_pastesSyntax) //w_paste为响应式窗口

ls_parm = MessageStringParm

if ls_parm <> cancel then

ll_pos = Pos ( ls_parm/)

If ll_pos = Then

ls_data = ls_parm

ls_disp = ls_parm

Else

ls_data = Left ( ls_parm ll_pos )

ls_disp = Mid ( ls_parm ll_pos + )

End If

dwpSetItem(dwpGetRow()valuels_data)

dwpSetItem(dwpGetRow()dispvaluels_disp)

dwpAcceptText()

end if

MenuItem = m_clear &D清除本列

Visible = true Enabled = true

Script for: clicked event

datawindow dwp

dwp = MessagePowerObjectParm

dwpDeleteRow()

dwpInsertRow()

End of Script

MenuItem = m_return &N返回

Visible = true Enabled = true

               

上一篇:在PB中用OLE存取blob类型数据(三)

下一篇:利用SQL语句对不同数据库进行高效果分页[1]