熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> SQL語言 >> 正文

在PB中如何實現數據模糊查詢(二)

2013-11-13 12:38:53  來源: SQL語言 
     屬性和代碼如下

     wroot_dw_query屬性

    X = Y = Width = Height =
    Visible = true Enabled = true TitleBar = true Title = 定位查詢
    ControlMenu = true Border = true WindowType = response! WindowState = normal!
    BackColor =

     窗口實例變量

    Boolean ib_changed
    Long MaxEditRow =
    String sWhere oldsql orisql is_title is_section = WhereClause
    DataWindow dw_resultdw_detail
    pfc_n_cst_string inv_string
    string sSyntax

    注釋apfc_n_cst_string 為PFC用戶對象

     窗口事件代碼

     close 事件

    功能將用戶本次所輸入的查詢條件記錄到文件sIniFile的WhereClausen小節中去以備下次啟動時置初始查詢條件

     open 事件

    功能設置初始值具體請看代碼中的注釋

    integer i row li_where_row =
    string tmp
    str_result_column lstr_
    //結構str_result_column的成員adw_result指查詢結果所產生作用的dw
    // 成員adw_column指在本窗口查詢條件所要顯示的dw
    lstr_ = MessagePowerObjectParm
    dw_result = lstr_adw_result
    dw_detail = lstr_adw_column
    if isnull(dw_result) or not isvalid(dw_result) then return
    if isnull(lstr_adw_column) or not isvalid(lstr_adw_column) then return
    window act_w
    act_w=MainWindowgetactivesheet()
    x = act_wx +
    y = act_wy + act_wheight height+
    width = act_wwidth
    cb_execx=width cb_execwidth
    cb_exitx=width cb_execwidth
    dw_wherex=
    dw_whereWidth = width * dw_whereX cb_execwidth
    //s
    dw_columnvisible = False
    wf_setcolumn(lstr_adw_column dw_column)
    //orisql = dw_resultObjectDataWindowTableSelect //原始語法close中用
    orisql = dw_resultGetSqlSelect() //上句對CrossTab無效
    oldsql = lower(orisql)
    For i = to li_where_row
    dw_whereInsertRow()
    Next
    dw_wheresetrowfocusindicator(Hand!)
    dw_whereScrollToRow()
    dw_whereSetColumn(column)
    cb_execSetFocus()
    datawindowchild dwc
    dw_whereGetChild(columndwc)
    dwcSetTransObject(sqlca)
    dwcReset()
    For i = to dw_columnRowCount()
    tmp = dw_columnGetItemString(i)
    row = dwcInsertRow()
    dwcSetItem(rowtmp)
    Next
    //將用戶上次所輸入的查詢條件從文件sIniFile的WhereClausen小節中取出來
    //本次啟動時置為初始查詢條件
    window w_parent
    if dw_resultGetParent()typeof() = window! then
    w_parent = dw_resultGetParent()
    is_title = w_parenttitle
    else
    is_title = dw_resultDataObject
    end if
    ib_changed = True
    row =
    tmp =
    is_title = gnv_appis_regkey + \ + is_title + \ + scname
    For i = to li_where_row
    RegistryGet(is_title is_section + String(i) RegString! tmp)
    //tmp = ProfileString(sinifileis_titleWhereClause + string(i))
    if tmp <> and (Not IsNull(tmp)) then
    //SetProfileString(sinifileis_titleWhereClause + string(i))
    RegistrySet(is_title is_section + String(i) RegString! )
    row ++
    dw_whereobjectdata[row] = inv_stringof_gettoken(tmp )
    dw_whereobjectdata[row] = inv_stringof_gettoken(tmp )
    dw_whereobjectdata[row] = inv_stringof_gettoken(tmp )
    dw_whereobjectdata[row] = inv_stringof_gettoken(tmp )
    dw_whereobjectdata[row] = inv_stringof_gettoken(tmp )
    dw_whereobjectdata[row] = inv_stringof_gettoken(tmp )
    end if
    Next
    MaxEditRow = row // MaxEditRow 為dw_where中當前已編輯過的最大行的行號實例變量
    If MaxEditRow = Then MaxEditRow =


From:http://tw.wingwit.com/Article/program/SQL/201311/16310.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.