数据库A表:收费项目      药品名称        单位    金额    库存
            0001       复方甘草合剂       盒    12.00   100
            0002       复方维生素B片      瓶    1.70    100
            0003       黄体酮注射液       支    0.78     50
            0004       达克宁栓           盒    22.00    70
如和实现收费时操作员录入药品或收费项目的五笔或拼音首码后,按回车键即调出药品或收费项目选择界面

解决方案 »

  1.   

    我看輸入收費項目的第一個字符,"select * from 表 where 收費項目  like '" & text1.text & "%'" 就好了
      

  2.   

    ......生成汉字的五笔和拼音的索引表
    然后就可以了以前采集过汉字拼音表,不过索引是另一个哥们做的大哥能不能仔细说明一下,或者给咱发一个[email protected] 万分感谢
      

  3.   

    你可以用DBGrideh來實現這功能,當你從在Edit中輸入數據時按回車健那彈出藥品的相關信自成供操作人員選懌!你可以在edit的KeyPress事件中寫!
    這只是的提示你的作用,你可以自已去完善其功能!
      

  4.   

    我的做法在表中增加一个字段存放拼音编码然后用一个函数在输入时取得拼音进行保存和查询函数如下:
    function  GetChineseAsc(const crStr:String;crLength:Integer):String;
    var i,HighPosition,LowPosition:Integer;
        AscValue,AscStr:String;
    begin
      Result:='';
      i:=2; //1个汉字占用两个字节
      while i<=Length(crStr) do
      begin
        if Length(Trim(Result))=crLength then Break; //如果超过一定长度,则退出
        HighPosition:=Ord(crStr[i-1])-160;
        LowPosition:=Ord(crStr[i])-160;
        if (HighPosition<16) or (HighPosition>55) or (LowPosition<=0) or (LowPosition>94) then
        begin
          //if HighPosition>
          if crStr[i-1] in ['a'..'z','A'..'Z'] then
            Result:=Result+UpperCase(crStr[i-1]);
          i:=i+1;
          Continue;
        end;
        AscValue:=FormatFloat('00',HighPosition)+FormatFloat('00',LowPosition);
        AscStr:='';
        if (AscValue>='1601') and (AscValue<='1636') then
          AscStr:='A';
        if (AscValue>='1637') and (AscValue<='1832') then
          AscStr:='B';
        if (AscValue>='1833') and (AscValue<='2077') then
          AscStr:='C';
        if (AscValue>='2078') and (AscValue<='2273') then
          AscStr:='D';
        if (AscValue>='2274') and (AscValue<='2301') then
          AscStr:='E';
        if (AscValue>='2302') and (AscValue<='2432') then
          AscStr:='F';
        if (AscValue>='2433') and (AscValue<='2593') then
          AscStr:='G';
        if (AscValue>='2594') and (AscValue<='2786') then
          AscStr:='H';
        if (AscValue>='2787') and (AscValue<='3105') then
          AscStr:='J';
        if (AscValue>='3106') and (AscValue<='3211') then
          AscStr:='K';
        if (AscValue>='3212') and (AscValue<='3471') then
          AscStr:='L';
        if (AscValue>='3472') and (AscValue<='3634') then
          AscStr:='M';
        if (AscValue>='3635') and (AscValue<='3721') then
          AscStr:='N';
        if (AscValue>='3722') and (AscValue<='3729') then
          AscStr:='O';
        if (AscValue>='3730') and (AscValue<='3857') then
          AscStr:='P';
        if (AscValue>='3858') and (AscValue<='4026') then
          AscStr:='Q';
        if (AscValue>='4027') and (AscValue<='4085') then
          AscStr:='R';
        if (AscValue>='4086') and (AscValue<='4389') then
          AscStr:='S';
        if (AscValue>='4390') and (AscValue<='4557') then
          AscStr:='T';
        if (AscValue>='4558') and (AscValue<='4683') then
          AscStr:='W';
        if (AscValue>='4684') and (AscValue<='4924') then
          AscStr:='X';
        if (AscValue>='4925') and (AscValue<='5248') then
          AscStr:='Y';
        if (AscValue>='5249') and (AscValue<='5589') then
          AscStr:='Z';
        Result:=Result+AscStr;
        I:=I+2
      end;
    end;
      

  5.   

    昏~~,在Delphi中不能直接粘贴到CSDN的文本框中,害得我中转
      

  6.   

    我看輸入收費項目的第一個字符,"select * from 表 where 收費項目  like '" & text1.text & "%'" 就好了