我做了一个数据库的查询模块,想实现任意字段的查询,其中窗体上有一个COMBOX,填充了我数据库内的所有表名.所有字段,即显示出来为:  表名.字段名
可是里面显示的全部是英文,不利于用户交互,我想把它们全部改为中文的,可是参考了这上面的相关帖子,说最好表名和字段名都用英文的,只好却步了.但是有没有办法解决呢,即将  表名.字段名  这些内容全部转化为显示中文名称.

解决方案 »

  1.   

    这个好办,用additem方法,把英文字段名换成中文名称
      

  2.   

    利用数组或者另外一个combobox来映射E文名称
      

  3.   

    任意组合查询可以用下面的方法试试,假设有3个字段,当然可以更多,分别为姓名(txt1),年龄(txt2),单位(txt3)dim cx_str as string
    if txt1.text<>"" then
       cx_str="select * from table where name='" & txt1.text & "'"
    end if
    if txt2.text<>"" then
       if cx_str="" then
          cx_str="select * from table where age='" & txt2.text & "'"
       else
          cx_str=cx_str & "and age='" & txt2.text & "'"
       endif
    end if
    if txt3.text<>"" then
       if cx_str="" then
          cx_str="select * from table where cop='" & txt3.text & "'"
       else
          cx_str=cx_str & "and cop='" & txt3.text & "'"
       endif
    end if
    if cx_str="" then
       msgbox"没有指定查询条件!"
       exit sub
    else
       rs.open cx_str,conn
       if rs.eof and rs.bof then
          msgbox"没有符合条件的记录"
       else
        .............
       end if
    end if
      

  4.   

    leswang107(leswang107) :谢谢你
    我要的是把显示在COMBOX里的表名和字段名都转换为中文名,然后还要在查询的时候又把它们全部都转换回英文以便查找
    呵呵
    不知行不行哦
      

  5.   

    这很简单啊。弄俩个转换函数不就行了。private function convertname(sname as string) as string
      select case sname
        case "表一": convertname= "table1"
        case "表二": convertname= "table2"
        ...
      end select 
    end function
      

  6.   

    拖一个combobox2,设置visible=false,里面的item和你显示中文表名的combobox1的item对应起来,
    然后在combobox1的change或者click事件代码添加
    combobox2.listindex=combobox1.listindex然后再用模糊查询(用的是combobox2.listindex)
      

  7.   

    可是我这个COMBOBOX里的内容都是不一定的啊
    随时都可能改变的,如果用添加的方法的话,不一定就中文和英文相对应的啊?