频道直达 - 专题 - 新闻 - 技巧 - 组网 - 开发 - 安全 - web编程 - 图像 - 操作系统 - 数据库 - 教育 - 旅游 - 健康 - 时尚 - 驱动 - 软件 - 游戏 - 多媒体 - ERP - 讨论组

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

来源:yesky 作者:张爱生 出处:巧巧读书 2006-04-09 进入讨论组

  4. 函数:

  4.1 public function string wf_getywname (string hzname)函数

  功能:返回"表名.列名",如"department.d_id"。

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

  4.2 public function string wf_getywtype (string hzname)函数

  功能:返回列类型。

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

  注释:

  (1) f_getoken()函数代码如下:

在PB中如何实现数据模糊查询(图十二)

  4.3 public function string wf_dateconvert (string svalue)函数

  功能:见程序中注释。

string syear,smonth,sday
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 bef,aft
/* bef 为日期,aft为时间*/
position = pos(inputvalue," ")
if position = 0 then inputvalue += " 00:00:00"
position = pos(inputvalue," ")
if position = 0 then
return "error"
else
bef = left(inputvalue , position - 1)
aft = right(inputvalue,len(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 syear,smonth,sday
date idate
idate = date(bef)
syear = string(year(idate))
smonth = right('00'+string(month(idate)),2)
sday = right('00'+string(day(idate)),2)
return syear+smonth+sday
end function
public subroutine wf_setcolumn (datawindow dw_1, datawindow dw_2)
pfc_n_cst_string lnv_string
String scol, stable_col
String shz, syw, stype, stable
Integer i, row
If Not IsValid(dw_1) Then Return
If Not IsValid(dw_2) Then Return
dw_2.ReSet()
For i =1 To long(dw_1.Object.DataWindow.Column.Count)
scol = dw_1.Describe("#" + String(i) + ".Name") //列名(可变)
stable_col = dw_1.Describe(scol + ".dbName") //所在表.列名(OK)
stable = lnv_string.of_gettoken(stable_col,".") //所在表
syw = stable_col //列名(不变.OK)
shz = trim(dw_1.Describe(scol + "_t.Text")) //中文名
stype = dw_1.Describe(scol + ".ColType") //列类型
if dw_1.Describe(scol + ".Type") = "column" &
and shz <> "!" and shz <> "?" then
shz = lnv_string.of_globalreplace(shz,"'","") //去掉单引号
shz = lnv_string.of_globalreplace(shz,'"','') //去掉双引号
shz = lnv_string.of_globalreplace(shz,"~r~n","_") //去掉换行符
shz = lnv_string.of_globalreplace(shz," ","_") //去掉空格
shz = lnv_string.of_globalreplace(shz,":","") //去掉冒号
shz = lnv_string.of_globalreplace(shz,":","") //去掉冒号
row = dw_2.InsertRow(0)
dw_2.object.data[row,1] = shz
dw_2.object.data[row,2] = syw
dw_2.object.data[row,3] = stype
dw_2.object.data[row,4] = stable
end if
Next
更多文章 更多内容请看SQL Server 索引和查询专题专题,或进入讨论组讨论。
更多专题 【深 度 阅 读】 相 关 文 章
    收藏此文】【 】【打印】【关闭
    相关图文阅读
    频道图文推荐
    健 康 咨 询
    时 尚 咨 询
    巧巧读书宗旨
    相关专题
    讨论组问题推荐
    站内各频道最新更新文档
    站内最新制作专题
    热门关键字导读
    Photoshop教 程照片处理 照片制作 PS快捷键 抠图
    计 算 机 故 障XP系统修复
    艺 术 与 设 计设计 流媒体 设计欣赏 边框
    计 算 机 安 全ARP
    站内频道文章精选