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

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

2022-06-13   來源: SQL語言 
     函數

     public function string wf_getywname (string hzname)函數

    功能返回表名列名departmentd_id


     public function string wf_getywtype (string hzname)函數

    功能返回列類型

    注釋

    () f_getoken()函數代碼如下


     public function string wf_dateconvert (string svalue)函數

    功能見程序中注釋

    string syearsmonthsday
    date idate
    idate = date(svalue)
    syear = string(year(idate))
    smonth = string(month(idate))
    sday = string(day(idate))
    svalue = syear + + smonth + + sday
    return svalue
    end function
    public function string wf_datetime (string inputvalue)
    inputvalue = trim(inputvalue)
    integer position
    string befaft
    /* bef 為日期aft為時間*/
    position = pos(inputvalue )
    if position = then inputvalue += ::
    position = pos(inputvalue )
    if position = then
    return error
    else
    bef = left(inputvalue position )
    aft = right(inputvaluelen(inputvalue) position)
    if (not isdate(bef)) or (not istime(aft)) then
    return error
    end if
    end if
    //bef = wf_dateconvert(bef)
    //return bef + + aft
    string syearsmonthsday
    date idate
    idate = date(bef)
    syear = string(year(idate))
    smonth = right(+string(month(idate)))
    sday = right(+string(day(idate)))
    return syear+smonth+sday
    end function
    public subroutine wf_setcolumn (datawindow dw_ datawindow dw_)
    pfc_n_cst_string lnv_string
    String scol stable_col
    String shz syw stype stable
    Integer i row
    If Not IsValid(dw_) Then Return
    If Not IsValid(dw_) Then Return
    dw_ReSet()
    For i = To long(dw_ObjectDataWindowColumnCount)
    scol = dw_Describe(# + String(i) + Name) //列名(可變)
    stable_col = dw_Describe(scol + dbName) //所在表列名(OK)
    stable = lnv_stringof_gettoken(stable_col) //所在表
    syw = stable_col //列名(不變OK)
    shz = trim(dw_Describe(scol + _tText)) //中文名
    stype = dw_Describe(scol + ColType) //列類型
    if dw_Describe(scol + Type) = column &
    and shz <> ! and shz <> ? then
    shz = lnv_stringof_globalreplace(shz) //去掉單引號
    shz = lnv_stringof_globalreplace(shz) //去掉雙引號
    shz = lnv_stringof_globalreplace(shz~r~n_) //去掉換行符
    shz = lnv_stringof_globalreplace(shz _) //去掉空格
    shz = lnv_stringof_globalreplace(shz:) //去掉冒號
    shz = lnv_stringof_globalreplace(shz) //去掉冒號
    row = dw_InsertRow()
    dw_objectdata[row] = shz
    dw_objectdata[row] = syw
    dw_objectdata[row] = stype
    dw_objectdata[row] = stable
    end if
    Next

     public function long wf_min (long a long b long c)函數

    功能給定三個數abc 如果abc均為 則返回;否則返回abc中不為的數中的最小值: a = b = c = 則返回: a = b = c = 則返回: a = b = c = 則返回
long b long c)函數


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