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

📄 uadoset.pas

📁 这是一个啤酒行业的软件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
             end;
             Close;
             Sql.Clear;
             if _Sql='' then
             begin
                showmessage('sql语句错误...');
                exit;
             end;
             Sql.Text:=trim(_Sql);
             if _str.getSubStringCount(':',_Sql)<>paramValues.Count then
             begin
                 showmessage('参数的个数不匹配...');
                 exit;
             end;
             if paramValues=nil then
             begin
                exit;
             end;
             if paramValues.Count<>0 then
             begin
                for i:=0 to  paramValues.count-1 do
                begin
                    Parameters[i].value:=paramValues[i];
                end;
             end
             else
             begin
             end;

             prepared;
             open;
             if Recordcount<>0 then
             begin
                if FieldByName(FieldName).DataType=ftString then /////String型///
                begin
                   result:=FieldByName(FieldName).AsString;
                end;
                if FieldByName(FieldName).DataType=ftSmallInt then /////SmallInt型///
                begin
                   result:=FieldByName(FieldName).AsInteger;
                end;
                if FieldByName(FieldName).DataType=ftInteger then /////SmallInt型///
                begin
                   result:=FieldByName(FieldName).AsInteger;
                end;
                if FieldByName(FieldName).DataType=ftFloat then /////SmallInt型///
                begin
                   result:=FieldByName(FieldName).AsFloat;
                end;
             end;//if


          end;//with
    Finally
         _FQuery.Close;
    end;
end;
{
  功能:
  参数:
  用法:
}
Function TuAdoSet.getFieldValue(FieldName:string):Variant;
var
   i:integer;
begin
     try
        with _FQuery do
        begin
             if _FDbType=1 then
             begin
                 ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID='+trim(_FLoginID)+';Initial Catalog='+_FdbName+';Data Source='+trim(_FserverName)+'';
             end;
             if _FDbType=2 then
             begin
                 ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+_FDbName+';Persist Security Info=False';
             end;
             Close;
             Sql.Clear;
             if _FSqlString='' then
             begin
                showmessage('sql语句错误...');
                exit;
             end;
             Sql.Text:=trim(_FSqlString);
             if _str.getSubStringCount(':',_FSqlString)<>_FParamList.Count then
             begin
                showmessage('参数的个数不匹配...');
                exit;
             end;
             if _FParamList=nil then
             begin
                exit;
             end;
             if _FParamList.Count<>0 then
             begin
                for i:=0 to  _FParamList.count-1 do
                begin
                    Parameters[i].value:=_FParamList[i];
                end;
             end
             else
             begin
             end;

             prepared;
             open;
             if Recordcount<>0 then
             begin
                if FieldByName(FieldName).DataType=ftString then /////String型///
                begin
                   result:=FieldByName(FieldName).AsString;
                end;
                if FieldByName(FieldName).DataType=ftSmallInt then /////SmallInt型///
                begin
                   result:=FieldByName(FieldName).AsInteger;
                end;
                if FieldByName(FieldName).DataType=ftInteger then /////SmallInt型///
                begin
                   result:=FieldByName(FieldName).AsInteger;
                end;
                if FieldByName(FieldName).DataType=ftFloat then /////SmallInt型///
                begin
                   result:=FieldByName(FieldName).AsFloat;
                end;
             end;//if


          end;//with
    Finally
         _FQuery.Close;
    end;
end;
{
  功能:
  参数:
  用法:
}

Function TuAdoSet.getFieldList(_Sql:string;paramValues:TStringList;FieldName:string):TStringList;
var
   _tmp:TStringList;
   i:integer;
begin
    _tmp:=TStringList.Create;

   try

      with _FQuery do
      begin
           if _FDbType=1 then
           begin
               ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID='+trim(_FLoginID)+';Initial Catalog='+_FdbName+';Data Source='+trim(_FserverName)+'';
           end;
           if _FDbType=2 then
           begin
               ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+_FDbName+';Persist Security Info=False';
           end;
           Close;
           Sql.Clear;
           if _Sql='' then
           begin
              showmessage('sql语句错误...');
              exit;
           end;
           Sql.Text:=trim(_Sql);
           if _str.getSubStringCount(':',_Sql)<>paramValues.Count then
           begin
               showmessage('参数的个数不匹配...');
               exit;
           end;
           if paramValues=nil then
           begin
              exit;
           end;
           if paramValues.Count<>0 then
           begin
              for i:=0 to  paramValues.count-1 do
              begin
                  Parameters[i].value:=paramValues[i];
              end;
           end
           else
           begin
           end;

           prepared;
           open;
           if recordcount<>0 then
           begin
              _tmp.Clear;
              while not Eof do
              begin
                   _tmp.Add(FieldByName(FieldName).asString);
                   next;
              end;//while
           end;///if
      end;//with
      result:=_tmp
   Finally

      _FQuery.close;
   end;

end;///
{
  功能:
  参数:
  用法:
}
Function TuAdoSet.getFieldList(FieldName:string):TStringList;
var
   i:integer;
   _tmp:TStringList;
begin
   _tmp:=TStringList.Create;
   try

      with _FQuery do
      begin
           if _FDbType=1 then
           begin
               ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID='+trim(_FLoginID)+';Initial Catalog='+_FdbName+';Data Source='+trim(_FserverName)+'';
           end;
           if _FDbType=2 then
           begin
               ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+_FDbName+';Persist Security Info=False';
           end;
           Close;
           Sql.Clear;
           if _FSqlString='' then
           begin
              showmessage('sql语句错误...');
              exit;
           end;
           Sql.Text:=trim(_FSqlString);
           if _str.getSubStringCount(':',_FSqlString)<>_FParamList.Count then
           begin
              showmessage('参数的个数不匹配...');
              exit;
           end;
           if _FParamList=nil then
           begin
              exit;
           end;
           if _FParamList.Count<>0 then
           begin
              for i:=0 to  _FParamList.count-1 do
              begin
                  Parameters[i].value:=_FParamList[i];
              end;
           end
           else
           begin
           end;

           prepared;
           open;
           if recordcount<>0 then
           begin
              _tmp.Clear;
              while not Eof do
              begin
                   _tmp.Add(FieldByName(FieldName).asString);
                   next;
              end;//while
           end;///if
      end;//with
      result:=_tmp
   Finally

      _FQuery.close;
   end;
end;
{
  功能:
  参数:
  用法:
}
procedure TuAdoSet.getRecordList(Value:Array of TStringList);
var
   i,j:integer;
   _RCount:integer;
begin
    try
         with _FQuery do
         begin
             if _FDbType=1 then
             begin
                 ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID='+trim(_FLoginID)+';Initial Catalog='+_FdbName+';Data Source='+trim(_FserverName)+'';
             end;
             if _FDbType=2 then
             begin
                 ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+_FDbName+';Persist Security Info=False';
             end;
             Close;
             Sql.Clear;
             if _FSqlString='' then
             begin
                showmessage('sql语句错误...');
                exit;
             end;
             Sql.Text:=trim(_FSqlString);
             if _str.getSubStringCount(':',_FSqlString)<>_FParamList.Count then
             begin
                showmessage('参数的个数不匹配...');
                exit;
             end;
             if _FParamList=nil then
             begin
                exit;
             end;
             if _FParamList.Count<>0 then
             begin
                for i:=0 to  _FParamList.count-1 do
                begin
                    Parameters[i].value:=_FParamList[i];
                end;
             end
             else
             begin
             end;

             prepared;
             open;
             _RCount:=RecordCount;
             ///showmessage(inttostr(_Rcount));
             ////setlength(Value,_RCount);
             for i:=0 to _RCount-1 do
             begin
                 ////Value[i]:=TStringList.Create;
                 Value[i].Clear;
             end;

             if recordcount<>0 then
             begin
                i:=0;
                while not eof do
                begin
                     for j:=0 to FieldDefList.Count-1 do
                     begin
                         Value[i].Add(FieldByName(FieldDefList[j].Name).asstring);
                     end;//for
                     next;
                     inc(i);
                end;/// while
             end;//if
       end;//with

     Finally
       _FQuery.Close;
     end;
end;
{
  功能:
  参数:
  用法:
}
procedure  TuAdoSet.getRecordList(_Sql:string;paramValues:TStringList;Value:Array of TStringList);
var
   i,j:integer;
   _RCount:integer;
begin
     try
         with _FQuery do
         begin
             if _FDbType=1 then
             begin
                 ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID='+trim(_FLoginID)+';Initial Catalog='+_FdbName+';Data Source='+trim(_FserverName)+'';
             end;
             if _FDbType=2 then
             begin
                 ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+_

⌨️ 快捷键说明

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