您的位置:程序门 -> vb ->



如何调用function iscontain函数在vb中


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


如何调用function iscontain函数在vb中[已结贴,结贴人:aeae12]
发表于:2007-10-26 19:06:22 楼主
select   *  
from   comparebase   inner   join   zd_xm5   on   iscontain(comparebase.xm_name,zd_xm5.xm_name)   =   true;  

函数定义如下:  

public   function   iscontain(str1   as   string,   str2   as   string)   as   boolean  
             

             
        iscontain   =   false  
             
        if   instr(str2,   str1)     >   0   then  
                      '不论str1长度多少,只要str1完全在str2中,认为符合条件  
                iscontain   =   true  
        else  
                if   len(str1)     <=   5   then  
                              '因为不完全包含,且str1长度小于等于5,认为不符合  
                        iscontain   =   false  
                else  
                              'str1长度       > 5,需要循环判断str1中的任意连续5个字符是否在str2中  
                        dim   i   as   integer  
                        i   =   1  
                        for   i   =   1   to   len(str1)   -   4  
                                if   instr(str2,   mid(str1,   i,   5))     >   0   then  
                                        iscontain   =   true  
                                        exit   for  
                                end   if  
                        next   i  
                end   if  
        end   if  
             
end   function  

以上代码在access中测试没问题  
我用adodc连接access数据库,要求数据库中不建立查询,怎样在vb中实现上面的功能,调用iscontain函数呢,哪位大哥给段源码,越完整越好,我水平很滥的。不胜感激


快速检索

最新资讯
热门点击