?? unttfuncface.pas
字號:
功 能: 依據類別檢索函數記錄集
參 數: ADOQueryF : TADOQuery; P_Type : string
返回值: true,false
作 者: 胡孟杰
日 期: 2005.08.26
==========================================================================}
function Func_GetFuncByType(ADOQueryF: TADOQuery; P_Type: string): boolean;
stdcall;
begin
Result := false;
try
with ADOQueryF do
begin
Close;
Sql.text :=
'Select ID,Type,Subject,Uses From Func where Type = :P_Type';
Parameters.ParamByName('P_Type').Value := Copy(P_Type, 1, 150);
Open;
end;
Result := true;
except
// Error
end;
end;
{==========================================================================
函數名: Func_FindType
功 能: 在表Func中查找類別明細,返回執行成功與否
參 數: ADOConnection:數據庫連接對象 P_Type : string 表屬性值
返回值: True,false
作 者: 胡孟杰
日 期: 2005.08.17
==========================================================================}
function Func_FindType(ADOConnection: TADOConnection; P_Type: string): boolean;
var
Func : TFunc;
begin
Func := TFunc.Create(AdoConnection);
with Func do
begin
PType := P_Type; //string Type
Result := FindType; //查找類別明細
Free;
end;
end;
{==========================================================================
函數名: Func_GetTypeByID
功 能: 在表Func中查找類別,返回類別
參 數: ADOConnection:數據庫連接對象 P_ID : Integer 表屬性值
返回值: True,false
作 者: 胡孟杰
日 期: 2005.08.17
==========================================================================}
function Func_GetTypeByID(ADOConnection: TADOConnection; P_ID: Integer; P_Type:
PChar): boolean;
var
Func : TFunc;
begin
Func := TFunc.Create(AdoConnection);
with Func do
begin
PID := P_ID; //ID
Result := GetTypeByID; //查找類別
if Result then
StrCopy(P_Type, PChar(PType));
Free;
end;
end;
{==========================================================================
函數名: Func_UpdateType
功 能: 在表Func中批量更新類別,返回執行成功與否
參 數: ADOConnection:數據庫連接對象 NewType : string 表屬性值
返回值: True,false
作 者: 胡孟杰
日 期: 2005.08.17
==========================================================================}
function Func_UpdateType(ADOConnection: TADOConnection; OldType, NewType:
string): boolean; stdcall;
var
Func : TFunc;
begin
Func := TFunc.Create(AdoConnection);
with Func do
begin
PType := OldType; //string Type
Result := UpdateType(NewType); //更新類別
Free;
end;
end;
{==========================================================================
函數名: Func_SearchBySubject
功 能: 依據標題檢索函數庫
參 數: ADOQueryF : TADOQuery; P_Subject : string
返回值: true,false
作 者: 胡孟杰
日 期: 2005.08.26
==========================================================================}
function Func_SearchBySubject(ADOQueryF: TADOQuery; P_Subject: string): boolean;
stdcall;
begin
result := false;
try
with ADOQueryF do
begin
Close;
if Trim(P_Subject) = '' then
Sql.text := 'Select ID,Type,Subject,Uses From Func '
else
Sql.text := 'Select ID,Type,Subject,Uses From Func where Subject like '
+ #39 + '%' + P_Subject + '%' + #39;
Open;
end;
result := true;
except
//Error
end;
end;
{==========================================================================
函數名: Func_GetIDSubList
功 能: 依據標題檢索,取回ID和標題列表
參 數: ADOConnection: TADOConnection; SubKey : string; IDList, SubList: Tstrings
返回值: true,false
作 者: 胡孟杰
日 期: 2005.08.26
==========================================================================}
function Func_GetIDSubList(ADOConnection: TADOConnection; SubKey: string;
IDList, SubList: Tstrings): boolean; stdcall;
var
Func : TFunc;
ID_List, Sub_List : Tstrings;
begin
Result := false;
Func := TFunc.Create(AdoConnection);
with Func do
begin
AdoQuery.Close;
if Trim(SubKey) = '' then
AdoQuery.SQL.Text := 'Select ID,Subject,Type From Func ' +
' ORDER BY Type, ID'
else
AdoQuery.SQL.Text :=
'Select ID,Subject,Type From Func where Subject like ' + #39
+ '%' + SubKey + '%' + #39 + ' ORDER BY Type, ID';
AdoQuery.Open;
if AdoQuery.Recordset.RecordCount > 0 then
begin
ID_List := Tstringlist.Create;
Sub_List := Tstringlist.Create;
AdoQuery.Recordset.MoveFirst;
while not AdoQuery.Recordset.EOF do
begin
ID_List.Add(intToStr(AdoQuery.Recordset.Fields['ID'].Value)); //ID
Sub_List.Add(AdoQuery.Recordset.Fields['Subject'].Value); //Subject
AdoQuery.Recordset.MoveNext;
end;
IDList.Text := ID_List.Text;
SubList.Text := Sub_List.Text;
ID_List.Free;
Sub_List.Free;
Result := true;
end;
Free;
end;
end;
{==========================================================================
函數名: Func_GetIDListByType
功 能: 依據類別檢索函數庫,取得ID和標題列表
參 數: ADOConnection: TADOConnection; P_Type: string; IDList, SubList: Tstrings
返回值: true,false
作 者: 胡孟杰
日 期: 2005.08.28
==========================================================================}
function Func_GetIDListByType(ADOConnection: TADOConnection; P_Type: string;
IDList, SubList: Tstrings): boolean; stdcall;
var
Func : TFunc;
ID_List, Sub_List : Tstrings;
begin
Result := false;
Func := TFunc.Create(AdoConnection);
with Func do
begin
AdoQuery.Close;
AdoQuery.SQL.Text := 'Select ID,Subject,Type From Func where Type=:P_Type'
+
' ORDER BY Type, ID';
AdoQuery.Parameters.ParamByName('P_Type').Value := Copy(P_Type, 1, 150);
AdoQuery.Open;
if AdoQuery.Recordset.RecordCount > 0 then
begin
ID_List := Tstringlist.Create;
Sub_List := Tstringlist.Create;
AdoQuery.Recordset.MoveFirst;
while not AdoQuery.Recordset.EOF do
begin
ID_List.Add(intToStr(AdoQuery.Recordset.Fields['ID'].Value)); //ID
Sub_List.Add(AdoQuery.Recordset.Fields['Subject'].Value); //Subject
AdoQuery.Recordset.MoveNext;
end;
IDList.Text := ID_List.Text;
SubList.Text := Sub_List.Text;
ID_List.Free;
Sub_List.Free;
Result := true;
end;
Free;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -