写有如下一个DLL(此DLL在DELPHI程序下调用通过)
------------------------------------------------------------------------
library W_AddAB;{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }uses
  SysUtils,dialogs,
  Classes;{$R *.res}
function ab(a:integer;b:integer):integer;stdcall;
begin
   result := a+b;
end;
exports ab;begin
end.
------------------------------------------------------------------------
在MS SQL的查询分析器中执行如下语句来注册扩展存储过程.
USE master
go
EXEC sp_addextendedproc myproc, 'W_AddAB.dll'
go但调用不了.exec master..myproc 
提示:
ODBC: 消息 0,级别 16,状态 1
无法装载 DLL W_AddAB.dll 或该 DLL 所引用的某一 DLL。原因: 126(找不到指定的模块。)。
--------------------------------------------------------------------------Q:
1,怎样在MS SQL里面怎样注册一个"扩展存储过程"?
2,注册之后,怎样去调用?

解决方案 »

  1.   

    问题1已经解决
    USE master
    go
    EXEC sp_addextendedproc ab, 'W_AddAB.dll'--ab为DLL里的函数名;
    go但执行
    exec
    master..ab 1,1 
    时,只提示命令已成功完成。
    没有返回值(2)啊???
      

  2.   

    EXEC sp_addextendedproc 'ab', 'W_AddAB.dll'  DECLARE @parFirst int  //参数1
    DECLARE @parSecond int  //参数2
    DECLARE @rt int //返回值SELECT @parFirst = 1     
    SELECT @parSecond = 1EXEC @rt = ab @parFirst,@parSecondSELECT @rt
      

  3.   

    回复人: luke5678(奇异) ( ) 信誉:101  2004-11-17 19:33:00  得分: 0  
     
     
       EXEC sp_addextendedproc 'ab', 'W_AddAB.dll'  DECLARE @parFirst int  //参数1
    DECLARE @parSecond int  //参数2
    DECLARE @rt int //返回值SELECT @parFirst = 1     
    SELECT @parSecond = 1EXEC @rt = ab @parFirst,@parSecondSELECT @rt
    --------------------------------------------------------------------
                
    ----------- 
    432022265(所影响的行数为 1 行)
    --------------------------------------------------------------------
    怎会得这个啊?