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

📄 unttfuncface.pas

📁 delphi制作的帮助学习软件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  功  能:    依据类别检索函数记录集
  参 数:    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 + -