怎样在MS SQL注册一个"扩展存储过程"?

internetcsdn 2004-11-17 12:15:46
写有如下一个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,注册之后,怎样去调用?
...全文
109 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
internetcsdn 2004-11-22
  • 打赏
  • 举报
回复
internetcsdn 2004-11-21
  • 打赏
  • 举报
回复
up
luke5678 2004-11-18
  • 打赏
  • 举报
回复
先mark一下
internetcsdn 2004-11-18
  • 打赏
  • 举报
回复
回复人: 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 = 1

EXEC @rt = ab @parFirst,@parSecond

SELECT @rt
--------------------------------------------------------------------

-----------
432022265

(所影响的行数为 1 行)
--------------------------------------------------------------------
怎会得这个啊?



internetcsdn 2004-11-17
  • 打赏
  • 举报
回复
问题1已经解决
USE master
go
EXEC sp_addextendedproc ab, 'W_AddAB.dll'--ab为DLL里的函数名;
go

但执行
exec
master..ab 1,1
时,只提示命令已成功完成。
没有返回值(2)啊

???
deodarsydn 2004-11-17
  • 打赏
  • 举报
回复
up
lw549 2004-11-17
  • 打赏
  • 举报
回复
学习
luke5678 2004-11-17
  • 打赏
  • 举报
回复
EXEC sp_addextendedproc 'ab', 'W_AddAB.dll'

DECLARE @parFirst int //参数1
DECLARE @parSecond int //参数2
DECLARE @rt int //返回值

SELECT @parFirst = 1
SELECT @parSecond = 1

EXEC @rt = ab @parFirst,@parSecond

SELECT @rt

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧