⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spellinputdmcunit.pas

📁 仓库管理系统 貌似是ACCESS的数据库
💻 PAS
字号:
unit SpellInputDMCUnit;

interface

uses
  SysUtils, Classes, DB, DBClient, SimpleDS;

type
  TSpellInputDM = class(TDataModule)
    sdsSpellInput: TSimpleDataSet;
    dsSpellInput: TDataSource;
 private
    { Private declarations }
    Str_Sql:string;
  public
    { Public declarations }
    procedure OfferAllRecord(const ATableName,Name,ID,ASpell:string);
    {提供表中所有的记录}
    procedure Locatebyspell(ASpell:string);
    {根据拼音简码进行定位}
    procedure OfferSelectRecord(var ACode,AName:string);
    {返回当前选中记录内容}
    procedure MovePoint(const ADirct:string);
  end;

var
  SpellInputDM: TSpellInputDM;

implementation

{$R *.DFM}

{ TSpellInputDM }

procedure TSpellInputDM.Locatebyspell(ASpell: string);
begin
   if length(ASpell) <= sdsSpellInput.FieldByName('Name').size then
     begin
       sdsSpellInput.Locate('Name',ASpell,[lopartialkey]);
     end;
end;

procedure TSpellInputDM.MovePoint(const ADirct: string);
begin
if ADirct='up' then
begin
 if not sdsSpellInput.bof then
        sdsSpellInput.Prior;
end;
if ADirct='down' then
begin
if not sdsSpellInput.eof then
       sdsSpellInput.next;
end;
end;

procedure TSpellInputDM.OfferAllRecord(const ATableName,Name,ID,ASpell: string);
begin
  Str_Sql:='select '+Name+ ' as Name,'+ID+' as ID from '+ATableName+' '+
           'where '+Name+' like '''+'%'+Aspell+'%'+''' order by '+ID;
  sdsSpellInput.Close;
  sdsSpellInput.DataSet.CommandText := str_sql;
  sdsSpellInput.Open;
end;

procedure TSpellInputDM.OfferSelectRecord(var ACode, AName: string);
begin
  ACode:=sdsSpellInput.fieldbyname('ID').asstring;
  AName:=sdsSpellInput.fieldbyname('Name').asstring;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -