BBS.ChinaUnix.net
首页 | 新闻 | Linux | AIX | 博客 | 论坛 | 存储 | 网络 | 人才 | 知识库 | 资料 | 读书 | 手册 | 精华 | 下载 | 空间     
  会员: 密码: 免费注册 | 忘记密码 | 会员登录 | 搜索 | 帮助 


奥运快报: 
奥运热点:
 

用Sybase移动数据库开发CRM系统几个关键问题的技术实现

首页 » 论坛 » Sybase »  
[打印] [订阅] [收藏] [推荐给朋友] [本帖文本页]
rozsoft
新手




UID:636719
注册:2007-11-2
最后登录: 2007-11-05
帖子:2
精华:0

可用积分:2 (白手起家)
信誉积分:0
专家积分:0 (本版)

状态:...离线...

[个人空间] [短信] [博客]


顶部
1楼 发表于 2007-11-5 15:57 
在这里想与做技术的兄弟们分享几个技术问题的详细的解决办法。

应用介绍:汽车移动销售,就是销售人员通过移动设备,如PDA、智能手机,将销售应用系统安装于移动设备上,实现移动办公、移动销售,移动设备通过GPRS等无线网络与销售中心进行联系,销售所需要的各种信息可以根据需要下载到移动设备上,销售人员收集的客户信息、销售订单信息等可以根据需要上传到销售中心。

开发环境:
数据库:SQL Anywhere 9
开发工具:SYBASE PocketBuilder 2.0
模拟环境:Microsoft Windows Mobile 5.0 MSFP Emulator Images
模拟平台:Pocket PC 2003 SE 仿真程序


问题1:如何实现模糊查询、同音字查询?比如知春路写成支椿路的话照样能够检索出来怎么实现。
分析:我们在查询信息时(如按某一人名查询、按某一地名查询),经常会遇到只知道发音不知道具体是哪个汉字的情况,为此我们提供同音字的模糊查询,可大大方便用户的查询,只要输入相同拼音的汉字,即可查出某信息(如人员姓名、单位地址等)。为实现此功能,数据库中除存储汉字信息外,还自动存储汉字对应的汉语拼音信息(不用人工处理,通过数据库中的触发器自动完成)。这样在查询时,通过数据库的自定义函数取得汉字所对应的汉语拼音,再与数据库中存储的汉语拼音信息相匹配进行检索。
具体实现关键代码:


1.客户模糊查询(可输入客户名称、客户地址进行同音字的查询)
string cname,cmobile,caddress,thissql,cnamecode,caddresscode
cname=string(trim(sle_name.text))
cmobile=string(sle_mobile.text)
caddress=string(trim(sle_address.text))

//通过函数取得汉字对应的汉语拼音
cnamecode=f_pinyin(cname)
caddresscode=f_pinyin(caddress)
thissql="(1=1)"
if rb_1.checked then  //如果选择“同音字模糊查询”
if len(cname)<>0 then
  thissql=thissql+" and (customer_customername_pinyin like '" + cnamecode +"')"
end if
if len(cmobile)<>0 then
  thissql=thissql + " and (customer_mobile like '" + cmobile +"')"
end if
if len(caddress)<>0 then
  thissql=thissql + " and (customer_address_pinyin like '"+ caddresscode +"')"
end if
//精确查询
elseif rb_2.checked then
if len(cname)<>0 then
  thissql=thissql+" and (customer_customername_pinyin like '%" + cnamecode +"%')"
end if
if len(cmobile)<>0 then
  thissql=thissql + " and (customer_mobile like '%" + cmobile +"%')"
end if
if len(caddress)<>0 then
  thissql=thissql + " and (customer_address_pinyin like '%"+ caddresscode +"%')"
end if
end if
//模糊查询
tab_1.tabpage_3.dw_1.settransobject(sqlca)
tab_1.tabpage_3.dw_1.setfilter(thissql)
//tab_1.tabpage_3.dw_1.setfilter( "customer_customer_id=customer_customer_id[1]")
tab_1.tabpage_3.dw_1.filter( )

//today
string stoday = String(now(),"yyyymmdd")
tab_1.tabpage_3.dw_1.retrieve(stoday)

if tab_1.tabpage_3.dw_1.rowcount()=0 then
messagebox("系统提示","没有符合条件的记录")
sle_name.text=""
sle_mobile.text=""
sle_address.text=""
return
end if
tab_1.selecttab(3)


2、 取汉字所对应的汉语拼音的函数
integer li_len,li_loc
string ls_hz,ls_py_code,ls_output
li_loc=1
ls_output=''
li_len=len(inputstring)
ls_output=''
do while li_len > 0
ls_hz=mid(inputstring,li_loc,1)
//从数据库读取汉字所对应的汉语拼音
select trim(pinyin) into :ls_py_code from char_pinyincode where hanzi_char=:ls_hz order by pinyin;
if isnull(ls_py_code) then
ls_py_code=''
end if
if ls_py_code='' then
ls_output=ls_output+"_"+ls_hz
else
ls_output=ls_output+"_"+ls_py_code
end if
li_len=li_len - 1
li_loc=li_loc + 1
loop
if mid(ls_output,1,1)='_' then
ls_output=right(ls_output,len(ls_output)-1)
end if
li_len=len(ls_output)
return ls_output

问题2:如何实现图片的动态存储?如从数据库读取图片内容并显示到图片控件中
分析:将图片的内容存储在数据库中,在需要浏览图片时,从数据库中读取图片信息直接显示在图片中。这样做的好处是,方便对图片资源的备份(随数据库的备份一块进行),图片不占用额外的存储空间;若将图片存储在磁盘上,会由于存储路径发生变化而找不到图片资源,通过数据库存储就避免了该问题。

具体实现关键代码:
selectblob car_pic_total into :photo from auto_stock
WHERE (car_brand like :carbrand) AND (car_type like :cartype) AND (car_color like :carcolor)   
   using sqlca;
if not isnull(photo) then
  //将二进制内容与图片控件相关联
tab_stock.tabpage_2.p_2.setpicture(photo)
end if


问题3、如何实现手持设备与服务器的数据同步?
分析:通过 MobiLink 来实现手持设备与服务器的数据同步。由于开始时设置信息考虑不全面,在某些设备上不能成功与服务器进行数据进行。后经过程序完善,可以实现在各种手持设备与服务器的数据同步。

具体实现关键代码:


string cmd, path
string exe_name
string connect_string, other_arguments
long    rc, idx

// ASA key
if -1 = RegistryGet(ASA_REGPATH, "Location", path) then
MessageBox("Error", "Cannot find ASA path.")
return -1
end if

// append "\win32" to path if running on desktop
if iEnv.ostype = windowsnt! then
path = path + "\win32"
connect_string = " -c ~"dsn=" + is_desktop_dsn +"~""
else
connect_string = " -c ~"dsn=" + is_ce_dsn +"~""
end if

exe_name = path + "\dbmlsync.exe"
uf_generate_sync_class_name()
if NOT IsNull(is_quiet) and Len(is_quiet) > 0 then
other_arguments = " " + is_quiet
else
other_arguments = ""
end if
if NOT IsNull(is_logging) and Len(is_logging) > 0 then
other_arguments += is_logging
end if
other_arguments += " -k "
if NOT IsNull(is_additional_args) and Len(is_additional_args) > 0 then
other_arguments +=  is_additional_args
end if
if NOT IsNull(is_extended_args) and Len(is_extended_args) > 0 then
other_arguments += ' -e ~"' + is_extended_args + '~"'
end if

integer iPos
iPos=pos(lower(connect_string),"dsn=filedsn=")
if iPos > 0 then
connect_string=left(connect_string,iPos -1 )+right(connect_string,len(connect_string) - iPos -4 +1)
end if
//通过调用数据同步组件的方法,进行数据同步,
rc = pb_run_dbmlsync(exe_name, is_publication_name, is_mluser, is_mlpassword, connect_string, other_arguments, is_sync_class_name )
return  rc

以上是我们的心血结晶,无偿与各位分享,只希望多些志同道合的朋友,希望与Sybase及iAnywhere产品有兴趣的朋友们多多交流 。

各位大仙们还有什么更好的实现方法,也希望能共同分享、探讨!:)



您对本贴的看法:鲜花[0] 臭蛋[0]
奥运专版发帖奖1800积分! | Web安全应用现状有奖调查 | 致电800-858-2903,了解DELL如何为你量身订制笔记本
bombshell
新手




UID:406992
注册:2006-4-21
最后登录: 2008-06-05
帖子:7
精华:0

可用积分:7 (白手起家)
信誉积分:100
专家积分:0 (本版)

状态:...离线...

[个人空间] [短信] [博客]


顶部
2楼 发表于 2007-11-5 21:49 
太感谢了,我现在也打算做这方面的应用,分享您的经验。



您对本贴的看法:鲜花[0] 臭蛋[0]
奥运专版发帖奖1800积分! | Web安全应用现状有奖调查 | 致电800-858-2903,了解DELL如何为你量身订制笔记本

首页 » 论坛 » Sybase »


 


Copyright © 2001-2008 ChinaUnix.net All Rights Reserved     联系我们:

感谢所有关心和支持过ChinaUnix的朋友们    转载本站内容请注明原作者名及出处

京ICP证041476号


清除 Cookies - ChinaUnix - Archiver - WAP - TOP

Processed in 0.053056 second(s), 4 queries , Gzip enabled