万能查询器DLL使用说明 http://www.absky.cn/?product-80.html

销售网址:http://www.absky.cn/?product-80.html

 

1、万能查询器DLL带自动分页功能, 它的自动分页功能,避开存储过程分页和数据集分页,直接自动在取数之前就分好。相比其它形式的分页更简单实用且运行速度更快。


2、可以以OleVariant形式返回指定的单个值,单行数据,多行数据,返回查询语句,还可以手动修改自动生成的查询语句,做到真正的方便实用。

 

4、全部功能集中在一个DLL文件中,调用相关的函数即可,方便实用。

 

3、支持smallint,int,string,datetime,date等数据类型的字段的模糊查询。更贴进用户的使用习惯。

 

 

 

运行效果图1

 

 

运行效果图2

 

运行效果图3

 

 

 

运行效果图4

 

 

运行效果图5

 

 

实例代码说明:

ConnectionString:= Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=127.0.0.1

 

CommandText :=select OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry from Orders

 

DLL引出函数说明:

 

 

1Function GetDialogFieldValue(ParentHandle:THandle;ConnectSql,SqlText,ReturnFieldName:WideString;Out Value:OleVariant):Boolean;stdcall;

 

作用: 根据传入参数,返回指定字段的选定值; 执行成功返回True,否则返回False;

参数说明:

    ParentHandle    THandle      ----- 调用此函数的程序句柄; 

    ConnectSql      WideString    ----- 数据库连接字符串;

    SqlText         WideString    ----- 查询的SQL语句;

    ReturnFieldName WideString    ----- 返回值的字段名,缺省为第一个字段的值;

    Value:            OleVariant     ----- 返回值;

 

调用实例代码:

var

   GetDialogFieldValue:Function(PHandle:THandle;ConnectSql,SqlText,ReturnFieldName:WideString;Out Value:OleVariant):Boolean;stdcall;

   value:OleVariant;

   LibHandle: THandle;

begin

  try

    LibHandle := LoadLibrary(pChar('E:/ProfitSky/Dll/QueryDialog/QueryDialog.dll'));

    @GetDialogFieldValue := GetProcAddress(LibHandle,'GetDialogFieldValue');

    if Assigned(GetDialogFieldValue) then

    begin

      if GetDialogFieldValue(Handle,ConnectionString,CommandText,'',value) then

      ShowMessage(VarToStr(value));

    end;

  finally

    FreeLibrary(LibHandle);

  end;

end;

 

2Function GetDialogSingleRowValue( ParentHandle:THandle;ConnectSql,SqlText:WideString;

ColumnWidthArray:OleVariant;Out Value:OleVariant):Boolean;stdcall;

 

作用:根据传入参数,生成查询数据集,返回选择行的整行值;执行成功返回True,否则返回False;

参数说明:

    ParentHandle      THandle      ----- 调用此函数的程序句柄; 

    ConnectSql        WideString    ----- 数据库连接字符串;

    SqlText           WideString    ----- 查询的SQL语句;

    ColumnWidthArray OleVariant     ----- 标识每列宽度,原型为Array of Integer

    Value:              OleVariant     ----- 返回值;原型为Array of OleVariant;

 

调用实例代码:

 

var

   j:Integer;

   ivalue:OleVariant;

    s:Array of OleVariant;

   GetDialogSingleRowValue:Function(ParentHandle:THandle;ConnectSql,SqlText:WideString;ColumnWidthArray:OleVariant;Out Value:OleVariant):Boolean;stdcall;

begin

  try

    LibHandle := LoadLibrary(pChar('E:/ProfitSky/Dll/QueryDialog/QueryDialog.dll'));

    @GetDialogSingleRowValue := GetProcAddress(LibHandle,'GetDialogSingleRowValue');

    if Assigned(GetDialogSingleRowValue) then

    begin

      if GetDialogSingleRowValue(Handle,ConnectionString,'select OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShipCountry from Orders',

       VarArrayOf([0,0,80,80,80,80]),ivalue) then

       begin

          s:=ivalue;

          for j:=0 to length(s)-1 do

            ShowMessage(VarToStr(s[j]));

       end;

    end;

  finally

    FreeLibrary(LibHandle);

    ivalue:=null;

        s:=nil;

  end;

end;

 

 

3Function GetDialogMultiRowValue(ParentHandle:THandle;ConnectSql,SqlText:WideString;

ColumnWidthArray:OleVariant;Out Value:OleVariant):Boolean;stdcall;

 

作用:根据传入参数,生成查询数据集,返回选择的多行的值;执行成功返回True,否则返回False;

参数说明:

    ParentHandle      THandle      ----- 调用此函数的程序句柄; 

    ConnectSql        WideString    ----- 数据库连接字符串;

    SqlText           WideString    ----- 查询的SQL语句;

    ColumnWidthArray OleVariant     ----- 标识每列宽度,原型为Array of Integer

    Value:              OleVariant     ----- 返回值;原型为Array of Array of OleVariant;;

 

调用实例代码:

 

var

   i,j:Integer;

   ivalue:OleVariant;

   s:Array of Array of OleVariant;   GetDialogMultiRowValue:Function(ParentHandle:THandle;ConnectSql,SqlText:WideString;ColumnWidthArray:

OleVariant;Out Value:OleVariant):Boolean;stdcall;

begin

  try

    LibHandle := LoadLibrary(pChar('E:/ProfitSky/Dll/QueryDialog/QueryDialog.dll'));

    @GetDialogMultiRowValue := GetProcAddress(LibHandle,'GetDialogMultiRowValue');

    if Assigned(GetDialogMultiRowValue) then

    begin

      if GetDialogMultiRowValue(Handle,ConnectionString,'select OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShipCountry from Orders',

       VarArrayOf([0,0,80,80,80,80]),ivalue) then

       begin

          s:=ivalue;

          for i:=0 to HIGH(s) do

          for j:=0 to length(s[i])-1 do

            ShowMessage(VarToStr(s[i][j]));

       end;

    end;

  finally

    FreeLibrary(LibHandle);

    ivalue:=null;

    s:=nil;

  end;

end;

 

 

4Function GetDialogSqlWhereExpression(ParentHandle:THandle;ConnectSql:WideString;

DynamicArray:OleVariant;out Value:WideString):Boolean;stdcall;

 

作用:根据传入参数,生成查询项目,返回查询字符串;执行成功返回True,否则返回False;

参数说明:

    ParentHandle      THandle      ----- 调用此函数的程序句柄; 

    ConnectSql        WideString    ----- 数据库连接字符串;

    DynamicArray     OleVariant     ----- 标识项目内容的数组,原型为Array of Variant

                                         格式为 [字段名, 字段显示名,数据类型, 查询列表的SQL语句]

    Value:              WideString    ----- 返回值;格式为 Where sql expression Order by sql expression;

 

调用实例代码:

var

   ivalue:WideString;

   GetDialogSqlWhereExpression:Function(ParentHandle:THandle;ConnectSql:WideString;DynamicArray:OleVariant;out Value:WideString):Boolean;stdcall;

begin

  try

    LibHandle := LoadLibrary(pChar('E:/ProfitSky/Dll/QueryDialog/QueryDialog.dll'));

    @GetDialogSqlWhereExpression := GetProcAddress(LibHandle,'GetDialogSqlWhereExpression');

    if Assigned(GetDialogSqlWhereExpression) then

    begin

      if GetDialogSqlWhereExpression(Handle,ConnectionString,

      VarArrayOf(['OrderID','订单ID',varString,'select OrderID AS 订单ID from Orders',

                  'CustomerID','客户ID',varString,'select CustomerID AS 客户ID from Orders',

                  'EmployeeID','员工ID',varString,'select EmployeeID AS 员工ID from Orders',

                  'OrderDate','订单日期',varDate,'select OrderDate AS 订单日期1, OrderDate AS 订单日期2, OrderDate AS 订单日期3 from Orders',

                  'RequiredDate','需求日期',varDate,'select RequiredDate AS 需求日期 from Orders',

                  'ShipCountry','船运国',varString,'select ShipCountry AS 船运国 from Orders']),ivalue) then

       begin

            ShowMessage(ivalue);

       end;

    end;

  finally

    FreeLibrary(LibHandle);

  end;

end;

 

 

5Function GetExecuteSingleRowValue(ParentHandle:THandle;ConnectSql,SqlText:WideString;

out Value:OleVariant):Boolean;stdcall;

 

作用:根据传入参数,执行SQL语句后返回查询的单行值;执行成功返回True,否则返回False;

参数说明:

    ParentHandle      THandle      ----- 调用此函数的程序句柄; 

    ConnectSql        WideString    ----- 数据库连接字符串;

    SqlText           WideString    ----- 查询的SQL语句;

   Value           OleVariant     ----- 返回值;原型为Array of OleVariant;

 

调用实例代码:

 

var

   j:Integer;

   ivalue:OleVariant;

    s:Array of OleVariant;

   GetExecuteSingleRowValue:Function(ParentHandle:THandle;ConnectSql,SqlText:WideString;out Value:OleVariant):Boolean;stdcall;

begin

  try

    LibHandle := LoadLibrary(pChar('E:/ProfitSky/Dll/QueryDialog/QueryDialog.dll'));

    @GetExecuteSingleRowValue := GetProcAddress(LibHandle,'GetExecuteSingleRowValue');

    if Assigned(GetExecuteSingleRowValue) then

    begin

      if GetExecuteSingleRowValue(Handle,ConnectionString,'select top 2 OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShipCountry from Orders',

       ivalue) then

       begin

          s:=ivalue;

          for j:=0 to length(s)-1 do

            ShowMessage(VarToStr(s[j]));

       end;

    end;

  finally

    FreeLibrary(LibHandle);

    ivalue:=null;

        s:=nil;

  end;

end;
6
Function GetExecuteMultiRowValue(ParentHandle:THandle;ConnectSql,SqlText:WideString;

out Value:OleVariant):Boolean;stdcall;

 

作用:根据传入参数,执行SQL语句后返回查询的单行值;执行成功返回True,否则返回False;

参数说明:

    ParentHandle      THandle      ----- 调用此函数的程序句柄; 

    ConnectSql        WideString    ----- 数据库连接字符串;

    SqlText           WideString    ----- 查询的SQL语句;

   Value           OleVariant     ----- 返回值;原型为Array of Array of OleVariant;

 

调用实例代码:

 

var

   i,j:Integer;

   ivalue:OleVariant;

   s:Array of Array of OleVariant;

   GetExecuteMultiRowValue:Function(ParentHandle:THandle;ConnectSql,SqlText:WideString;out Value:OleVariant):Boolean;stdcall;

begin

  try

    LibHandle := LoadLibrary(pChar('E:/ProfitSky/Dll/QueryDialog/QueryDialog.dll'));

    @GetExecuteMultiRowValue := GetProcAddress(LibHandle,'GetExecuteMultiRowValue');

    if Assigned(GetExecuteMultiRowValue) then

    begin

      if GetExecuteMultiRowValue(Handle,ADOConnection1.ConnectionString,'select top 2 OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShipCountry from Orders',

       ivalue) then

       begin

          s:=ivalue;

          for i:=0 to HIGH(s) do

          for j:=0 to length(s[i])-1 do

            ShowMessage(VarToStr(s[i][j]));

       end;

    end;

  finally

    FreeLibrary(LibHandle);

    ivalue:=null;

        s:=nil;

  end;

end;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值