?? spellinputdmcunit.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 + -